|
-
September 25th, 1999, 10:36 AM
#1
how to create CDC dc; - I am just plain confused
I took a function from codeguru. I want to call this function shown below in OnInitialUpdate.
void DrawBitmap( HDC hdc, ....)
I tried just typing:
OnInitialUpdate()
{
CDC dc;
DrawBitmap(dc.m_hDC, ....);
}
but in the function DrawBitmap(), I get a debug assertion error at the line:
ASSERT( hdc != NULL );
I don't understand how to construct or create the variable CDC dc;.
I have read through MSDN and am still stuck. Please, any response any one can give me to get past this debug assertion error will be greatly appreciated.
Sincerely,
Erich J. Ruth
-
September 25th, 1999, 11:52 AM
#2
Re: how to create CDC dc; - I am just plain confused
Usually in MFC the default constructor does nothing; so in your code you have a CDC variable that is not initialised.
Try this code:
OnInitialUpdate()
{
CDC* pDc = GetDC();
if (pDc != NULL)
{
DrawBitmap(pDc->m_hDC, ....);
ReleaseDC(pDc);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|