CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Child Window topmost

    Hi, I'm trying to get a child window to be topmost, really is a modeless dialog box, above other normal child windows. When I create the dialog box, I call SetWindowPos:

    SetWindowPos(hToolsDlg, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE);

    but when another child window moves or get active, it get above dialog box. I don't know why happens that.
    The style of de dialog box is:

    WS_SYSMENU | WS_VISIBLE | WS_CHILD | WS_EX_PALETTEWINDOW | WS_CLIPSIBLINGS

    and the style of the normal child window is:

    WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW

    Thanks.
    Last edited by The_Judgement; April 3rd, 2009 at 08:31 AM.

  2. #2
    Join Date
    Mar 2004
    Location
    KL, Malaysia
    Posts
    63

    Re: Child Window topmost

    Hi, may be you should check this out.

    LockSetForegroundWindow()

    Regards,
    Kevin Choong

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Child Window topmost

    SetWindowPos(hWnd, HWND_TOPMOST... adds WS_EX_TOPMOST style.
    WS_EX_TOPMOST applies only to top-level windows and not for the child ones.

    Note: child windows have the WS_CHILD style set; all others are top-level windows.

    [ later edit ]
    In other words: topmost can be only the toplevel windows.
    Last edited by ovidiucucu; April 6th, 2009 at 04:27 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  4. #4
    Join Date
    Mar 2009
    Posts
    2

    Re: Child Window topmost

    Thanks for reply.

    So, that means with that function and with the ES_EX_PALETTEWINDOW style I can do that.

    Anyone knows how to get a child window stay above other child windows? I've seen that in a program, Icofx, but I don't know how can I get that in C.

    Thanks.

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

Featured