how to call a function from a different class?
-
Hi all, lets say i have this function in a ReadWrite.cpp file: void CReadWriteDlg::OnButton4() { AfxMessageBox("test"); } how do i call this function from a function in a different file altogether, say, SystemTray.cpp: void CSystemTray::OnMyDeviceChange(WPARAM wParam, LPARAM lParam) { CReadWriteDlg::OnButton4(); //whats the correct syntax for this??? . . . . } any help is greatly appreciated! thanks!
-
Hi all, lets say i have this function in a ReadWrite.cpp file: void CReadWriteDlg::OnButton4() { AfxMessageBox("test"); } how do i call this function from a function in a different file altogether, say, SystemTray.cpp: void CSystemTray::OnMyDeviceChange(WPARAM wParam, LPARAM lParam) { CReadWriteDlg::OnButton4(); //whats the correct syntax for this??? . . . . } any help is greatly appreciated! thanks!
Is this code helpfuls
CMain *m_Main=(CMain*)GetParent();
m_Main->Variable for function;
WhiteSky
-
Hi all, lets say i have this function in a ReadWrite.cpp file: void CReadWriteDlg::OnButton4() { AfxMessageBox("test"); } how do i call this function from a function in a different file altogether, say, SystemTray.cpp: void CSystemTray::OnMyDeviceChange(WPARAM wParam, LPARAM lParam) { CReadWriteDlg::OnButton4(); //whats the correct syntax for this??? . . . . } any help is greatly appreciated! thanks!
If you work with Dialogs then have CWnd and handles. So it is right to use PostMessage with user defined messages ( ->RegisterMessage ). PostMessage is better then SendMessage because it puts the message in the internal message queue. Read the fine MSDN. :zzz:
Greetings from Germany