Advertisement

simple GDI problem

Started by January 17, 2002 08:41 AM
0 comments, last by graeme 22 years, 11 months ago
I have a simple one script windows shell, and within winmain I am trying to blit a rectangle from the desktop to my window, in vague anticipation of making a ''screen mate'' thingy (like that anoying sheep and the felix pet food advert that leaps around the desktop.) No direct X here, simple old GDI. I have a very tenuous grip on what exactly all this means, but here goes: // ShowWindow(hwnd, SW_HIDE); HDC hdcScreen ; hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); BitBlt(hdc, 0,0, WINDOW_WIDTH /2, WINDOW_HEIGHT/2, &hdcScreen, 200,200, SRCCOPY); // ShowWindow(hwnd, SW_SHOW); ReleaseDC(hwnd,hdc); This seems to work, but not very well! The visual effect is midely displeasing, in that you get a dr who title sequence effect in the window, the image replicating like Microsoft Patience game when you win! The nastiest aspect of the code is the way it eats up memory, and is rather destructive. I had to restart my machine after each attempt, and once this required a Windows ME system restore. Incidentally I am compiling with visual studio 6. What will fix the code??
It''d be an incredibly good idea to follow up your CreateDC with a DeleteDC when you''re through with it.

This topic is closed to new replies.

Advertisement