H
hernan.silberman
Hi folks,
I'm new to Windows programming and am diving into managed Visual C++.
I'm trying to tie an event handler to the closing of a Form and I need
help understanding what I'm doing wrong. This is from TestApp.cpp:
__delegate void CloseHandler(String*);
void TestApp::handleFormClose(String *aMsg)
{
Console::WriteLine("form closed!");
}
void TestApp::doInitUi()
{
myMainForm = new MainForm(); // System::Windows::Forms:Form data
member
// Add a listener to our form so we know when it's closed.
myMainForm->OnClosed +=
new CloseHandler( this, &TestApp::handleFormClose ); // error
is here
}
Here's the error I'm getting:
....\TestApp.cpp(55): error C2475:
'System::Windows::Forms::Form::OnClosed' :
forming a pointer-to-member requires explicit use of the
address-of operator ('&') and a qualified name
I don't see what I'm doing incorrectly, but I'm new to this. I
appreciate any help seeing my error.
thanks much,
Hernan
I'm new to Windows programming and am diving into managed Visual C++.
I'm trying to tie an event handler to the closing of a Form and I need
help understanding what I'm doing wrong. This is from TestApp.cpp:
__delegate void CloseHandler(String*);
void TestApp::handleFormClose(String *aMsg)
{
Console::WriteLine("form closed!");
}
void TestApp::doInitUi()
{
myMainForm = new MainForm(); // System::Windows::Forms:Form data
member
// Add a listener to our form so we know when it's closed.
myMainForm->OnClosed +=
new CloseHandler( this, &TestApp::handleFormClose ); // error
is here
}
Here's the error I'm getting:
....\TestApp.cpp(55): error C2475:
'System::Windows::Forms::Form::OnClosed' :
forming a pointer-to-member requires explicit use of the
address-of operator ('&') and a qualified name
I don't see what I'm doing incorrectly, but I'm new to this. I
appreciate any help seeing my error.
thanks much,
Hernan