Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MFC OnOK()

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
In MFC Programming, why is it that the OnOK() function (used to exit the program) does not work in the member functions that I add to the class? It only works in the functions that I attach to the command buttons. I get an error message saying that Assertion Failed.
 
OnOk is a member of the CDialog and CPropertyPage MFC classes. It's not a global Win32 function and can't just be called without some form of scope resolution :):) unless your class is specifically derived from the two classes just mentioned.

If you create a dialog based application using the MFC AppWizard (by defualt, your dialog class will then be derived from CDialog) and call OnOk within your dialog class, you are infact calling the CDialog class member function which has the effect of closing the dialog. Because the dialog is created modally in a dialog application, this effectively exits the app.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top