MessageBox With Timeout

This is a simple class that displays a message box and automatically closes it after a specified amount of time.

This class has a very simple interface

  • Two public constructors
  • 
    CMessageBoxEx()
    CMessageBoxEx(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, UINT uTimeOut, BOOL bShowTimeOut = TRUE)
    
  • Two public methods to execute Timed Out Message Box
    
    int DoMessageBox()
    int DoMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, UINT uTimeOut, BOOL bShowTimeOut = TRUE)
    
    The object creates a thread to check time elapsed. When timeout is reached, the thread posts WM_CLOSE message to the message box.