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... =(

Thanks in advance.

-Lukas

PS The code below is just a snippet from a larger program, but only the important stuff has been included.

Program ResGrabber;

Uses
        crt,windows;
type
        tResSettings=record
                        w,h,bits,refresh:integer;
                end;
var
        res:hdc;
        display:pchar;
        curr:tResSettings;
        dev:devmode;

BEGIN
clrscr;
Display := 'DISPLAY';
res := CreateDC(Display,Display,nil,{Am not sure what to put here... =( });
if res = {Also, what type does res return, so I can know what should go here for a failure} then
begin
writeln('GetCurrentSettings failed - the return value to res was null/nil.');
writeln;
write('<Press any key to continue...>');
readkey;
halt;
end;
with curr do
begin
w := GetDeviceCaps(res,HORZRES);
h := GetDeviceCaps(res,VERTRES);
bits := GetDeviceCaps(res,BITSPIXEL);
refresh := GetDeviceCaps(res,VREFRESH);
end;
writeln('The current resolution is ',curr.w,'x',curr.h,'x',curr.bits,' with a refresh rate of ',curr.refresh,' hz.');
DeleteDC(res); // Clear it out
END.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 04-Jun-04

Reply via email to