I'm completely new at this and I'm trying to use VS2013 and C++ and loosely follow "Ivor Horton's Beginning Visual C++ 2010" to figure out how windows form apps and dialogs work. I seem to be miserably failing at figuring out something that should be extremely simple.
I've made a form, MyForm
, added a button to it, IDD_DIALOG1
.
I also created a dialog, MyFirstDialog
.
I want to be able to launch MyFirstDialog
when I click on IDD_DIALOG1
.
The book talks about event handlers, but I can't seem to find a way to get to any, so instead I have been trying to add code in the button1_Click
function in MyForm.h
:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyFirstDialog dlg;
dlg.DoModal();
}
However, this completely breaks my program, with an assertion failure:
I've looked online but I wasn't able to figure it out at all...
OK, so I believe @The Forest And The Trees is right in his comment above, and WinForms don't work well with MFC.
I am switching over to pure MFC now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.