two windows

This is a discussion on two windows within the Windows Programming forums, part of the Platform Specific Boards category; In my program on startup a splash window with a button appears. When this window is closed then I want ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    two windows

    In my program on startup a splash window with a button appears. When this window is closed then I want the main app to be shown. My problems are that both windows are shown and when closing the splash window it causes both to close.
    Attached Files Attached Files
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Close the splash screen from the main window's create event

    Code:
    case WM_CREATE:
      // Do something, and finally:
      SendMessage(hWndSplash, WM_CLOSE, 0, 0);
      break;

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I tried that and still didn't work as I want it to. This splash screen is suppose be closed by the button. Also, sending the WM_CLOSE message still causes both windows to close.
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  4. #4
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Let me guess, you're posting a WM_QUIT message somewhere in your splash screens window procedure? (Either SendMessage(hWnd, WM_QUIT, 0, 0) or PostQuitMessage(0))
    Here's a quote from MSDN:
    If the function retrieves a message other than WM_QUIT, the return value is nonzero.

    If the function retrieves the WM_QUIT message, the return value is zero.

    If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. To get extended error information, call GetLastError.
    So if your code looks something like this:
    Code:
    while (GetMessage(...) > 0)
    {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
    }
    Then GetMessage will return 0 when the WM_QUIT message is posted and your program will exit. Solution: Don't post a WM_QUIT message in your spash screens window procedure.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    You're right, Eibro, that was my problem. Thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM

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