Click here to Skip to main content
15,913,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ATL equivalent of MFCs PreCreateWindow Pin
Chris Harrington11-Apr-01 4:02
Chris Harrington11-Apr-01 4:02 
GeneralRe: ATL equivalent of MFCs PreCreateWindow Pin
Erik Thompson11-Apr-01 11:33
sitebuilderErik Thompson11-Apr-01 11:33 
GeneralRe: ATL equivalent of MFCs PreCreateWindow Pin
Chris Harrington11-Apr-01 16:21
Chris Harrington11-Apr-01 16:21 
QuestionHow to prevent beep when enter key pressed in CEdit control Pin
10-Apr-01 17:08
suss10-Apr-01 17:08 
AnswerRe: How to prevent beep when enter key pressed in CEdit control Pin
Erik Thompson10-Apr-01 17:57
sitebuilderErik Thompson10-Apr-01 17:57 
GeneralRe: How to prevent beep when enter key pressed in CEdit control Pin
10-Apr-01 18:28
suss10-Apr-01 18:28 
Questionwhat's an operator HBRUSH?? Pin
Bilal Naveed10-Apr-01 16:45
Bilal Naveed10-Apr-01 16:45 
AnswerRe: what's an operator HBRUSH?? Pin
Christian Graus10-Apr-01 17:40
protectorChristian Graus10-Apr-01 17:40 
MFC GDI classes like CBrush, CDC and CBitmap are merely thin wrappers around Win32 functions. Everything that CDC, for example, does is really a wrapper around functions of the same name. So CDC::CreateCompatibleDC is a wrapper around a function called CreateCompatibleDC, which takes the same variables as CreateCompatibleDC ( a pointer to a DC or NULL), plus a HDC, which is a handle to a DC. A major benefit of this is that they are cleaned up by the destructor - not calling delete on a GDI resource in a Win32 program is a sure fire way to achieve memory leaks and disaster, MFC makes it a little harder to mess up.

CDC as a class is then just a spot to hold a HDC and do HDC stuff to it. Any class can overload an operator in order to enable implicit casting to that type, for example a string class would overload char* so you could put an instance of the class where a char * is expected. The GDI classes have such an overload, so that anything that expects the handle can get it, although I usually point to the member variable ( such as m_hDC, m_hBitmap, etc. ) to be sure.

Christian

The content of this post is not necessarily the opinion of my yadda yadda yadda.

To understand recursion, we must first understand recursion.
AnswerRe: what's an operator HBRUSH?? Pin
Michael Dunn10-Apr-01 19:25
sitebuilderMichael Dunn10-Apr-01 19:25 
GeneralPassing data betwwen 16 and 32bit process Pin
pangcy10-Apr-01 15:09
pangcy10-Apr-01 15:09 
GeneralRe: Passing data betwwen 16 and 32bit process Pin
11-Apr-01 1:27
suss11-Apr-01 1:27 
GeneralWin32 function SetClassLongPtr() not found Pin
10-Apr-01 14:50
suss10-Apr-01 14:50 
GeneralRe: Win32 function SetClassLongPtr() not found Pin
Michael Dunn10-Apr-01 19:22
sitebuilderMichael Dunn10-Apr-01 19:22 
GeneralOuput Help Please! Pin
Ryan Baillargeon9-Apr-01 17:52
Ryan Baillargeon9-Apr-01 17:52 
GeneralRe: Ouput Help Please! Pin
Christian Graus10-Apr-01 13:28
protectorChristian Graus10-Apr-01 13:28 
GeneralRe: Ouput Help Please! Pin
l a u r e n10-Apr-01 14:29
l a u r e n10-Apr-01 14:29 
GeneralMemory leak Pin
9-Apr-01 8:03
suss9-Apr-01 8:03 
GeneralRe: Memory leak Pin
AlexMarbus9-Apr-01 11:44
AlexMarbus9-Apr-01 11:44 
GeneralRe: Memory leak Pin
Christian Graus9-Apr-01 12:57
protectorChristian Graus9-Apr-01 12:57 
GeneralRe: Memory leak Pin
9-Apr-01 13:25
suss9-Apr-01 13:25 
GeneralRe: Memory leak Pin
Tim Deveaux9-Apr-01 13:45
Tim Deveaux9-Apr-01 13:45 
GeneralRe: Memory leak Pin
11-Apr-01 8:26
suss11-Apr-01 8:26 
GeneralDLL memory Allocation Pin
Conor Hunt9-Apr-01 6:42
Conor Hunt9-Apr-01 6:42 
GeneralRe: DLL memory Allocation Pin
9-Apr-01 7:13
suss9-Apr-01 7:13 
GeneralRe: DLL memory Allocation Pin
9-Apr-01 7:17
suss9-Apr-01 7:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.