Roar this has me all fluster-pated. Ok, In my WM_PAINT event I grab the DC and create an off screen DC and select a bitmap into it. At the end of the paint routine I bitblt it to the screen and clean up.

Whats got me all confused is that the fonts dont match up. I *thought* thats what CreateCompatableDC was supposed to handle. Either that or its the language im using (which is possible but doubtful).

Is there some API which I dont know about which enables you to copy a resource from a DC so I can select it into the off screen DC?

Posted on 2002-06-05 11:57:14 by Graebel
Sure Heres one for you ;)

[b]CopyGDIFont hDCDest:REQ, hDCSrc:REQ[/b]

invoke GetStockObject, DEFAULT_GUI_FONT
invoke SelectObject, hDCSrc, eax
push eax
invoke SelectObject, hDCDest, eax
[i]; Optionally, store the OLDhDCFont for cleanup here....[/i]
pop eax
invoke SelectObject, hDCSrc, eax

This will copy the font from source DC to dest DC. Its assumed that you backed up the DestDC's given font for cleanup purposes. I do something simular when i create GDI dc's like back buffers, i select junk items into it on the WM_CREATE, so i can get and store the object handles that comes with the DC on creation. Then thru out the source i dont need to worry about "what if's" when selecting things into the DC's.

However, from what your saying, is sounds like you havent, so you might want to add a storage line and make the macro specific, or do it before you call the macro. Again, i typically make back buffers etc in the WM_CREATE message, and kill everything in the WM_DESTROY message... Buy anyways, this will fix your poblem... hope it helps...

Posted on 2002-06-05 14:05:14 by NaN