Results 1 to 7 of 7

Thread: MessageBox API

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    West Hartford, CT, USA
    Posts
    42

    MessageBox API

    As I mentioned in an earlier post, I'm using the MessageBox API call to display a message before running a console application.

    Unfortunately, this acts as a "modal" form within my application. In other words, I can freely access other Windows, but my console application will not continue execution until the message box is closed.

    I tried to set the hWnd parameter to NULL and HWND_DESKTOP, but neither changes the behavior. Is there a way to keep the MessageBox on the desktop and allow my program to continue execution? Do I need to use a different API call?

    Any help would be greatly appreciated..

  2. #2
    jim mcnamara
    Guest
    MBAPPLMODAL - message box application modal is the default behavior. You need to use another kind of dialog box.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    West Hartford, CT, USA
    Posts
    42
    Any suggestions?

  4. #4
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    MB_OK would be good.
    Alcohol & calculus don't mix.
    Never drink & derive.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Create your own dialog template and dialog proc and use CreateDialog.
    You must extend your message loop then:
    Code:
    while(GetMessage(&msg, NULL, 0, 0) > 0)
    {
      if(!IsDlgMessage(hdlg, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
    hdlg is the handle returned by CreateDialog.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    How about starting a new thread? That should allow the program to continue. Note that if the program finishes, the message box will automagically be closed.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Good idea. Like
    Code:
    DWORD MBThreadMain(LPVOID pVoid)
    {
      MessageBox(NULL, "Hello", "Hello", MB_OK);
      return 0;
    }
    If you at one point want to stop until the messagebox is closed, use WaitForSingleObject
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width