Thread: Fixing Z-order on a modeless dialog?

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    161

    Fixing Z-order on a modeless dialog?

    I'm creating a modeless dialog that I want the use to be able to leave open while working in the main window. Problem is, the modeless dialog is still on top when the main window gets focus. Do I have to catch a message in the main window's procedure when it gets focus and use SetWindowPos? If so, what bloody message? I can't find anything on MSDN.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Yes, that is the function of a modeless dialog box. Dialog boxes are alwasy at teh top of the Z order. In fact thats the whole point of using a dialog box instead of a regular window. If you want yours to go below the main window, you need to create a new window, not a dialog box.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    Then how the hell do I create a new "window" from a resource template? That's what I thought CreateDialog() was for.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Lose the ........ty attitude and perhaps more people will be inclined to assist you.

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    I can't get the goddamn dialog/window to behave the way I want it to and it's ........ing me off.

  6. #6
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    ahhhhh. This works. Just had to change the arguments.
    Code:
    hwndSearch = CreateDialog(hinstMain, MAKEINTRESOURCE(DLG_SEARCH_MIPS), HWND_DESKTOP, SearchDlg);

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    hmmm. Not quite there. I can click either window to get it on top, but I can't figure out out to force the main window back on top with ShowWindow or SetWindowPos.

    edit: I got it.
    Last edited by Viper187; 06-20-2008 at 07:16 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Modeless Dialog Communication (MFC)
    By mhandlon in forum Windows Programming
    Replies: 8
    Last Post: 08-22-2006, 01:28 PM
  3. When my modeless dialog has been closed it doesn't open again
    By Frandy in forum Windows Programming
    Replies: 5
    Last Post: 11-21-2004, 08:45 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. V C++; dialog box; tab order; advancing thru
    By alzado in forum C++ Programming
    Replies: 2
    Last Post: 01-02-2002, 03:56 PM