Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AfxMessageBox and MessageBox

Status
Not open for further replies.

minifiredragon

Programmer
Jun 29, 2003
68
US
I was thinking on ways of altering the AfxMessageBox or MessageBox from a button shut down to an auto close. Is it possible?? With my other apps, I remove the OK button and in the InitDialog part, I set a timer. And in the OnTimer() I count down then call the OnOK();.

Beings that AfxMessageBox uses a string to set the Icon and the Buttons, I am not sure how to override it. I was looking around for the Afx definition and was hoping to alter it. The same thing occurs with the MessageBox.

If I can't do it, I will just create my own dialog boxes, set the icons and messages that I want to use. But I thought I'd ask since Palbano and PerFnurt seem to be rather excellent at having answer.

:)
 
Yes that can be accomplished but it requires a second thread in the process since the message box will block the main thread. So using any timer and thread combination that suites your fancy, like a TimerQueue, from the timeout event you can use the EndDialog() API to close the MessageBox.


-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top