[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

child window style?

I want to make a child window that is clipped by the main app window (its parent) and it should move with the main app window when the user moves it. This is exactly how the child documents behave in an MDI application. I can't use MFC though.

I have reproduced this same functionality by specifying the following window style for the child:

    WS_CHILD | WS_VISIBLE | WS_CAPTION

However, the title bar of this child is always greyed out. I cannot find any combination of styles that will allow the title bar to be active. I tried artificially setting the focus when the user clicks on the child using
SetFocus(), EnableWindow(), ShowWindow(), but to no avail, the title bar is still greyed out! This is more a stylistic annoyance than anything else as the functionality is there, please can someone tell me how to correct this!

Thanks!
     
0
Already_Googled
Asked:
Already_Googled
1 Solution
 
RichieHindleCommented:
Try sending the window a WM_NCACTIVATE message:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowMessages/WM_NCACTIVATE.asp

"The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state. [...] The DefWindowProc function draws the title bar or icon title in its active colors when the wParam parameter is TRUE and in its inactive colors when wParam is FALSE."
0
 
Already_GoogledAuthor Commented:
RichieHindle, you are a genius.

Thank you.. I have been looking for a solution for so long.

Thanks again.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now