Click to See Complete Forum and Search --> : Getting Device Context in CWinApp::InitInstance?


Sean Scott
April 2nd, 1999, 04:23 PM
How do I create a Device Context before any windows in my application have been created? I need to create a bitmap for use later in the creation process.

Thanks

Alek
April 5th, 1999, 01:13 PM
You maybe know the Device context is linked to the any window or more exact HWND type.
In CWinApp::InitInstance you are not created a window yet.
But you want to create a bitmap only and the DC is not needed.
To do it you should create an object HBITMAP and you can use
HBITMAP CreateBitmapIndirect( CONST BITMAP *lpbm /* pointer to the bitmap data */ );
See the help for details