Click here to Skip to main content
15,914,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Empty String Overkill Pin
VikramDelhi16-Dec-05 20:40
VikramDelhi16-Dec-05 20:40 
QuestionChange CStatic runtime? Pin
PatP0716-Dec-05 7:46
PatP0716-Dec-05 7:46 
AnswerRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 7:47
sitebuilderNish Nishant16-Dec-05 7:47 
GeneralRe: Change CStatic runtime? Pin
PatP0716-Dec-05 8:54
PatP0716-Dec-05 8:54 
GeneralRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 9:06
sitebuilderNish Nishant16-Dec-05 9:06 
GeneralRe: Change CStatic runtime? Pin
Nish Nishant16-Dec-05 9:08
sitebuilderNish Nishant16-Dec-05 9:08 
GeneralRe: Change CStatic runtime? Pin
PatP0716-Dec-05 10:22
PatP0716-Dec-05 10:22 
GeneralRe: Change CStatic runtime? Pin
Jörgen Sigvardsson16-Dec-05 12:43
Jörgen Sigvardsson16-Dec-05 12:43 
In addition to Nishant's answer:

The C++ objects are just simple wrappers around the Windows API. When you do "raw" windows programming, you deal with window handles. You've probably seen them in code - HWND is their C/C++ type. When you program without MFC or any other toolkit, you either use the builtin functions such as SetWindowText(), or manipulate the windows by sending different messages to them.

What MFC does for the common control windows, such as labels (CStatic), is that it wraps the window handle, and provides C++ methods for manipulating the windows. The methods then call the corresponding Windows API function or sends the appropriate message with parameters.

What this wrapping business means is that you actually have two objects to maintain in your code! In the case of m_text, there's the actual C++ object, and the actual window. These two object's lifetimes are not synchronized. When the m_text object's constructor has executed, the window object is not yet created. It is created in a successful call to Create(). When DestroyWindow() is called later on, the window object is destroyed, but the C++ object remains. Whenever the window object is not alive, most methods on any CWnd derived class are not available.


--
Pictures[^] from my Japan trip.
QuestionHow to execute an exe Pin
VikramDelhi16-Dec-05 3:12
VikramDelhi16-Dec-05 3:12 
AnswerRe: How to execute an exe Pin
toxcct16-Dec-05 3:47
toxcct16-Dec-05 3:47 
GeneralRe: How to execute an exe Pin
Eytukan16-Dec-05 3:54
Eytukan16-Dec-05 3:54 
GeneralRe: How to execute an exe Pin
toxcct16-Dec-05 4:08
toxcct16-Dec-05 4:08 
GeneralRe: How to execute an exe Pin
VikramDelhi16-Dec-05 4:18
VikramDelhi16-Dec-05 4:18 
GeneralRe: How to execute an exe Pin
toxcct16-Dec-05 4:23
toxcct16-Dec-05 4:23 
GeneralRe: How to execute an exe Pin
VikramDelhi16-Dec-05 4:31
VikramDelhi16-Dec-05 4:31 
GeneralRe: How to execute an exe Pin
GuimaSun16-Dec-05 5:27
GuimaSun16-Dec-05 5:27 
GeneralRe: How to execute an exe Pin
VikramDelhi16-Dec-05 19:59
VikramDelhi16-Dec-05 19:59 
QuestionChange Text property for all Dialogs Pin
mohanrajh16-Dec-05 1:45
mohanrajh16-Dec-05 1:45 
AnswerRe: Change Text property for all Dialogs Pin
grigsoft16-Dec-05 2:20
grigsoft16-Dec-05 2:20 
Questionaccessing context free grammer in c++ Pin
geeta_patil16-Dec-05 1:17
geeta_patil16-Dec-05 1:17 
AnswerRe: accessing context free grammer in c++ Pin
TheGreatAndPowerfulOz16-Dec-05 6:38
TheGreatAndPowerfulOz16-Dec-05 6:38 
QuestionChange of Background Color of dialog box Pin
Manmohan_198316-Dec-05 1:12
Manmohan_198316-Dec-05 1:12 
AnswerRe: Change of Background Color of dialog box Pin
khan++16-Dec-05 1:20
khan++16-Dec-05 1:20 
GeneralRe: Change of Background Color of dialog box Pin
Eytukan16-Dec-05 3:28
Eytukan16-Dec-05 3:28 
GeneralRe: Change of Background Color of dialog box Pin
Eytukan16-Dec-05 3:38
Eytukan16-Dec-05 3:38 

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.