bralston
asked on
OnOK in Modal Dialog Box
I have a modal dialog box in which the user clicks the OK button to start some processing. A progress bar on the dialog box indicates the status of the processing. However, there may be instances where I want to dialog box to come up and immediately start processing once it is on the screen(without input from the user). How can I send on OnOK message without the user doing anything?
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, the AutoOK is a variable that you define in the Mydlg class.
ASKER
jhance's suggestion is interesting, but doesn't quite do what I want. The user would still have to interact with the dialog to get things to work. I have come up with a different approach. Instead of using
dlg.DoModal()
I use the following
dlg.Create(IDD_DIALOG1,NUL L);
dlg.ShowWindow(SW_SHOW);
dlg.OnOK2();
OnOK2 is a public function which gives me access to the protected OnOK().
Thanks to everyone who responded.
dlg.DoModal()
I use the following
dlg.Create(IDD_DIALOG1,NUL
dlg.ShowWindow(SW_SHOW);
dlg.OnOK2();
OnOK2 is a public function which gives me access to the protected OnOK().
Thanks to everyone who responded.
ASKER
jhance's suggestion is interesting, but doesn't quite do what I want. The user would still have to interact with the dialog to get things to work. I have come up with a different approach. Instead of using
dlg.DoModal()
I use the following
dlg.Create(IDD_DIALOG1,NUL L);
dlg.ShowWindow(SW_SHOW);
dlg.UpdateWindow();
dlg.OnOK2();
OnOK2 is a public function which gives me access to the protected OnOK().
Thanks to everyone who responded.
dlg.DoModal()
I use the following
dlg.Create(IDD_DIALOG1,NUL
dlg.ShowWindow(SW_SHOW);
dlg.UpdateWindow();
dlg.OnOK2();
OnOK2 is a public function which gives me access to the protected OnOK().
Thanks to everyone who responded.
Yes, that would do it. Another thing I've done is set a timer in the dialog WM_INIT handler and then if the user doesn't do something in a certain period of time, press the OK or CANCEL for them so the application will continue.