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

This is a discussion on "Press any key to continue..." in a messagebox within the C++ Programming forums, part of the General Programming Boards category; I know how to make a: "Press any key to continue..." And how to use MessageBox. But how would make ...

  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 11:57 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21