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)
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)