Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"ScreenGrab"/BitBlt problem in Win98

Status
Not open for further replies.

PabloMc2

Programmer
Oct 13, 2003
1
GB
Hi there,

I've adapted a piece of code I found on the Net to do "screen grabs" at regular intervals. This works fine on XP Professional, but when I run it on a Windows 98 PC, the screen grabs are all corrupted (mainly black with swirls of multi-coloured "snow" on them).

I've checked all the API calls I make and they should all be Win95 compatible, so I think they should work (though I'm not sure about the CAPTUREBLT value and BitBlt specifies "16-bit co-ordinates only" ?!?) - the main part of the code is :-

const
CAPTUREBLT = $40000000;
...
hdcScreen := CreateDC('DISPLAY', nil, nil, nil);
hdcCompatible := CreateCompatibleDC(hdcScreen);
hbmScreen := CreateCompatibleBitmap(hdcScreen,GetDeviceCaps(hdcScreen, HORZRES),GetDeviceCaps(hdcScreen, VERTRES));
SelectObject(hdcCompatible, hbmScreen);
bmp := TBitmap.Create;
bmp.Handle := hbmScreen;
BitBlt(hdcCompatible, 0,0,bmp.Width, bmp.Height,hdcScreen,0,0,SRCCOPY OR CAPTUREBLT);
bmp.SaveToFile(BMPFileName);
...

Does anyone have any ideas why this doesn't work on Win98 ?

Cheers in advance,
P
(PabloMc2@aol.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top