Make window dock/undock to parent window
-
Hi, I am trying to do an app which has children windows inside it, and make it capable of when drag the mouse off the parent window it undocks and float all around the desktop, but for some reason i can seem to accomplish this. I am using the SetWindowLong method to change style of the window from WS_CHILD to WS_POPUP but it doesn't work, can someone please show me some code to make it work :sigh:
long lastStyle = NativeMethods.GetWindowLong(myControl.Handle,
(int)NativeMethods.GetWindowLongConst.GWL_EXSTYLE);long newStyle = NativeMethods.SetWindowLong(myControl.Handle,
(int)NativeMethods.GetWindowLongConst.GWL_STYLE,
(uint)NativeMethods.WindowStyles.WS_POPUP);newStyle = NativeMethods.SetWindowLong(myControl.Handle,
(int)NativeMethods.GetWindowLongConst.GWL_EXSTYLE,
(long)(NativeMethods.WindowStylesEx.WS_EX_APPWINDOW | NativeMethods.WindowStylesEx.WS_EX_TOOLWINDOW));myControl.Location = new Point(100, 200);//just a test