i copy a bmp into memory, then from memory to a window
this goes fine almost all the time, but from time to time, under certain platform (win9x - win2000 is always fine), instead of copying the bmp to the window, i get a grey screen - nothing was copied. but no error raises tho ... f someone could help !!
some code :
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); // normal DC, provides a "snapshot" of the screen contents.
hdcCompatible = CreateCompatibleDC(hdcScreen); // memory DC keeps a copy of this "snapshot" in the associated bmp
botx=GetDeviceCaps(hdcScreen, HORZRES);
boty=GetDeviceCaps(hdcScreen, VERTRES);
// Create a compatible bitmap for hdcScreen.
hbmScreen = CreateCompatibleBitmap(hdcScreen,botx,boty);
if (hbmScreen==NULL)
raise error
// Select the bitmaps into the compatible DC.
if (SelectObject(hdcCompatible, hbmScreen)==NULL)
raise error
// won't capture the window
ShowWindow(SW_HIDE);
//Copy color data for the entire display into a bitmap that is selected into a compatible DC.
if (BitBlt(hdcCompatible,topx,topy,botx, boty,hdcScreen, 0,0,SRCCOPY))
....
else
raise error
this goes fine almost all the time, but from time to time, under certain platform (win9x - win2000 is always fine), instead of copying the bmp to the window, i get a grey screen - nothing was copied. but no error raises tho ... f someone could help !!
some code :
HDC hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); // normal DC, provides a "snapshot" of the screen contents.
hdcCompatible = CreateCompatibleDC(hdcScreen); // memory DC keeps a copy of this "snapshot" in the associated bmp
botx=GetDeviceCaps(hdcScreen, HORZRES);
boty=GetDeviceCaps(hdcScreen, VERTRES);
// Create a compatible bitmap for hdcScreen.
hbmScreen = CreateCompatibleBitmap(hdcScreen,botx,boty);
if (hbmScreen==NULL)
raise error
// Select the bitmaps into the compatible DC.
if (SelectObject(hdcCompatible, hbmScreen)==NULL)
raise error
// won't capture the window
ShowWindow(SW_HIDE);
//Copy color data for the entire display into a bitmap that is selected into a compatible DC.
if (BitBlt(hdcCompatible,topx,topy,botx, boty,hdcScreen, 0,0,SRCCOPY))
....
else
raise error