[fpc-pascal] Windows unit problems

Thomas Schatzl tom_at_work at gmx.at
Wed Jun 9 12:30:05 CEST 2004


Hello,


> I'm attempting to retrieve information about the current resolution
> settings, but I'm not having much luck.  I've downloaded the Borland Win32
> API, but I'm still stuck with creating the device context, and so on.  I
> need some massive help with this... =(

Because the Borland help file is really outdated... use either the online
MS-Platform SDK help (or alternatively the search engine of your choice =)
or download it from MS.

Here's a small program which prints the screen characteristics you need to
the console (no need to fiddle around with device contexts, no error
handling):

program PrintScreenCharacteristics;

uses
  Windows;

var
  mode : TDevMode;

const
  // this constant does not seem to be defined in my FPC distro
  ENUM_CURRENT_SETTINGS = $FFFFFFFF;

begin
  EnumDisplaySettings(nil, ENUM_CURRENT_SETTINGS, mode);
  writeln(mode.dmPelsWidth, 'x', mode.dmPelsHeight, 'x',
    mode.dmBitsPerPel, '@',mode.dmDisplayFrequency);
  readln;
end.

See the MS-docs for this function for further explanation.

Compiles and runs with FPC 1.9.3 - 2004/04/09.

Regards,
  Thomas





More information about the fpc-pascal mailing list