Calling CWnd function between 2 dialogs
-
Dear all, If I have two window dialogs opening, say, A and B. And if A is activating, I want that in A::OnOK(), it can call a function in B, say B::bfunction(). However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time.. A::OnOK() { B dlg; dlg.function(); } Can I know how to solve it? My target is, when A is activating, if the user press OK, then the B dialog will bring to top and A will call the B's function.....and then close A dialog. Please help! Thanks a lot!!! :rose: :-O
-
Dear all, If I have two window dialogs opening, say, A and B. And if A is activating, I want that in A::OnOK(), it can call a function in B, say B::bfunction(). However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time.. A::OnOK() { B dlg; dlg.function(); } Can I know how to solve it? My target is, when A is activating, if the user press OK, then the B dialog will bring to top and A will call the B's function.....and then close A dialog. Please help! Thanks a lot!!! :rose: :-O
However, there is some CWnd function, e.g UpdateData(), SetForeGroundWindows(), SetWindowText() etc...included in the bfunction(), then it will fail in run time. That's because the dialog isn't created until you call b.DoModal() or b.Create(). Just creating the C++ object doesn't create the dialog, so any functions that operate on the dialog via its HWND will fail. --Mike-- http://home.inreach.com/mdunn/ I'm finger-lickin' good!