Keeping MDI Child always at the top

  • Thread starter Thread starter Beenish Sahar Khan
  • Start date Start date
B

Beenish Sahar Khan

I'm working on a C# application(2003.) I have an MDI form which contains
multiple MDI children, i want to bring an MDI child in the front and make it
the top most form. As you can see, i want it to show the behavior of a
normal form when the (normal form's) TopMost property is set to true, i-e.
we could work on the other MDI children but the TopMost MDI Child will
remain in the front even if it is deactivated. In case of MDI Children
TopMost property is not working :(. I used Win32 SetWindowPos() function,

SetWindowPos(this.Handle,HWND_TOPMOST,0, 0, 0, 0,Win32.SWP_NOMOVE |
Win32.SWP_NOSIZE) ;

where HWND_TOPMOST = -1.

Although this function works for making the Child as the Top form (where
hWndInsertAfter(second argument) = 0)
but its not simplly working for making it the top most form. I tried to use
the SetWindowLong() func.
(SetWindowLong(this.Handle.ToInt64(), -8,this.MdiParent.Handle.ToInt64());)
along with SetWindowPos() but no luck :(
I would appreciate, if you could provide me with any solution (if it is a
non Win32 solution then it will be a bonus for me.)
regards,
Beenish Khan
 
Back
Top