The pointer arriving in the thread function is correct. But the structure it points to has a pointer member (probably a CDialog *) which is not allocated on the heap! That one is the pain, and it doesn't appear in his posting.
Off the top of my head, you could have a ON_COMMAND_UPDATE for the mdi child (which is where the
close command ends up) and use pCmdUI->SetText (m_bCanClose ? "Close" : "Password") to change the
text. You would also need a command handler to change the behaviour between password entry and the
For a "proper" app, you should load the menu strings from a resource rather than hardwired as above,
but you get the idea?
Straight from MSDN: If you implement a callback function, you will receive a handle to the dialog box. One use of this window handle is to modify the layout or contents of the dialog box. Because it is not resizable, modifying the old-style dialog box is relatively straightforward. Modifying the new-style dialog box is much more difficult, and not recommended. Not only does it have a different size and layout than the old style, but its dimensions and the positions of its controls change every time it is resized by the user.
When running a debug build using "Go"(F5), the debug output window shows memory leaks after the termination of the app.
Commercial products are considerably more sophisticated, but tend to be expensive and complicated.
ihaml wrote: Not everybody uses MFC and/or the built-in wizards
But everybody who has to ask such a basic question definitly should.
Please get me right:
I am not attacking the question on memory leak detection, but the implication in the answer that beginners should not be using the Wizard. We can discuss about MFC, but the Wizard is definitely a good thing to get your Project going: Setting up the whole mess is very error prone.
I want to write a Internet Logger that logs all visited websites during a dail up session. I have 2 questions:
1. How do i know the URLs of the websites being visited
2. How do I hide my program from the ctrl+alt+del list?
(I am allowed to show an icon in the system tray, but i have to prevent the user from terminationg the app- I already know how to prevent the user from exiting the application in the normal way- but what if he/she uses ctrl+alt+del?)