Click here to Skip to main content
15,911,890 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dyanmic tab Pin
deeps_cute30-Mar-07 22:46
deeps_cute30-Mar-07 22:46 
GeneralRe: Dyanmic tab Pin
Naveen30-Mar-07 22:50
Naveen30-Mar-07 22:50 
GeneralRe: Dyanmic tab Pin
prathuraj31-Mar-07 1:54
prathuraj31-Mar-07 1:54 
GeneralRe: Dyanmic tab Pin
Naveen1-Apr-07 17:09
Naveen1-Apr-07 17:09 
QuestionProblem with Pointers Pin
CoffeeAddict1930-Mar-07 13:35
CoffeeAddict1930-Mar-07 13:35 
AnswerRe: Problem with Pointers Pin
cp987630-Mar-07 13:49
cp987630-Mar-07 13:49 
GeneralRe: Problem with Pointers Pin
CoffeeAddict1931-Mar-07 19:17
CoffeeAddict1931-Mar-07 19:17 
GeneralRe: Problem with Pointers Pin
cp987631-Mar-07 20:42
cp987631-Mar-07 20:42 
I should have explained the cause of the problem: Creating a listbox in the dialog creates a windows listbox (identified by a handle) but not any CWnd object. MFC overloads the GetDlgItem() to return a CWnd* so that you can use all the MFC CWnd:: functions, but as there is no CWnd object, it creates a temporary one which is cleaned up later in some idle processing time. I guess that your experience shows that this cleanup doesn't usually happen during DoModal(), but does if the dialog is run modeless.

What you could get and save is the HWND of each of your controls, this would stay valid for the lifetime of the dialog window. This is what you are essentially doing when you add a CListBox data member to your class and associate it with the particular windows control in the DoDataExchange() function. The HWND of the control is set in the DDX_Control() function from the ID you provide.

Adding these data members is automated (in VC6 use the class wizard, in VS2005 simply right click on the control in the dialog editor and select "Add Variable"). Then you have a CListBox that you can use in any member function once the dialog has been created.





Peter

"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

QuestionDoes VS 2005 Standard Edition support services Pin
dburns30-Mar-07 10:36
dburns30-Mar-07 10:36 
AnswerRe: Does VS 2005 Standard Edition support services Pin
George L. Jackson30-Mar-07 11:26
George L. Jackson30-Mar-07 11:26 
GeneralRe: Does VS 2005 Standard Edition support services Pin
dburns30-Mar-07 11:55
dburns30-Mar-07 11:55 
QuestionWhy? Pin
_808630-Mar-07 6:35
_808630-Mar-07 6:35 
AnswerRe: Why? Pin
jeron130-Mar-07 6:52
jeron130-Mar-07 6:52 
AnswerRe: Why? Pin
Mark Salsbery30-Mar-07 6:54
Mark Salsbery30-Mar-07 6:54 
GeneralRe: Why? Pin
_808630-Mar-07 22:02
_808630-Mar-07 22:02 
AnswerRe: Why Not? Pin
led mike30-Mar-07 8:53
led mike30-Mar-07 8:53 
Questioncompiling linux programs on windows xp Pin
shiraztk30-Mar-07 5:33
shiraztk30-Mar-07 5:33 
AnswerRe: compiling linux programs on windows xp Pin
shiraztk30-Mar-07 5:42
shiraztk30-Mar-07 5:42 
GeneralRe: compiling linux programs on windows xp Pin
Chris Losinger30-Mar-07 10:07
professionalChris Losinger30-Mar-07 10:07 
AnswerRe: compiling linux programs on windows xp Pin
Cedric Moonen30-Mar-07 7:19
Cedric Moonen30-Mar-07 7:19 
AnswerRe: compiling linux programs on windows xp Pin
led mike30-Mar-07 8:56
led mike30-Mar-07 8:56 
GeneralRe: compiling linux programs on windows xp Pin
Mark Salsbery30-Mar-07 15:07
Mark Salsbery30-Mar-07 15:07 
GeneralRe: compiling linux programs on windows xp Pin
shiraztk31-Mar-07 23:04
shiraztk31-Mar-07 23:04 
Questionasking c programming Pin
Arif Liminto30-Mar-07 5:30
professionalArif Liminto30-Mar-07 5:30 
QuestionRe: asking c programming Pin
Mark Salsbery30-Mar-07 7:04
Mark Salsbery30-Mar-07 7:04 

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.