Thread: "Press any key to continue..." in a messagebox

  1. #1
    Pawn, Pascal and C++
    Join Date
    Sep 2005
    Posts
    90

    "Press any key to continue..." in a messagebox

    I know how to make a:
    "Press any key to continue..."

    And how to use MessageBox.
    But how would make it in a MessageBox?

    Like instead of MB_OK
    (Which is is "Ok" button)
    What do I need to have?

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    you have to create your own dialog box -- MessageBox is not able to do that.

    In the dialog's OnTranslateMessage, just close the dialog when WM_KEYDOWN message is received. this is MFC example, but similar process in pure win32 api program.
    Code:
    BOOL CPressAnyKeyDlg::PreTranslateMessage(MSG* pMsg) 
    {
    	if(pMsg->message == WM_KEYDOWN)
    		CDialog::OnOK();
    	return CDialog::PreTranslateMessage(pMsg);
    }
    Last edited by Ancient Dragon; 12-13-2005 at 12:57 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM