   [win32] Window tear off
  Im trying to implement window tear off functionality. Where a child window created with WS_CHILD and a parent, can be torn off into a separate window, and not confined within the parents client area. ie one with no parent and the style of WS_OVERLAPPEDWINDOW.Here is what I have, but whilst the window does change to an overlapped window, it still is confined within the parents client area. ::SetParent( GetHandle(), 0 );::SetWindowLong( GetHandle(), GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE );::SetWindowPos( GetHandle(), 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED ); 
  I believe the extended style you want is WS_EX_TOOLWINDOW.Quote:MSDN - WS_EX_TOOLWINDOWCreates a tool window; that is, a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE. I've found that went you want to change many of the windows styles, it pretty much requires completely recreating the window.  In the MSDN documentation on Window styles, it frequently says whether you can change the style using SetWindowLong/SetWindowLongPtr or not.  And if you skim it, you'll see not many do.  One instance I found was I could use SetWindowLongPtr to change the border style in XP, but in Vista/Win 7, it quit working and returned an error.  This is because a lot of data is cached for windows (see A window can have a parent or an owner but not both about just the repercussions of trying to change a window's parent.Also, you should use SetWindowLongPtr instead of SetWindowLong.[edit]Also, you need to add the WS_POPUP to replace the WS_CHILD.  That might also give the results you want.[Edited by - Rattrap on May 21, 2010 7:34:03 AM];Quote:Original post by Rattrap[edit]Also, you need to add the WS_POPUP to replace the WS_CHILD.  That might also give the results you want.Sorry, not sure what you mean by this   ;  If you want it to float, you need to make it a popup, just removing the WS_CHILD attribute isn't likely enough.  You need to add WS_POPUP to the style.::SetWindowLongPtr( GetHandle(), GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_POPUP); [Edited by - Rattrap on May 22, 2010 7:18:50 PM]