VB Snippet - MDI Child Topmost
Code:
you need a MDIForm and two MDIChild Forms
in MDIForm
Private Sub MDIForm_Load()
Form1.Show
Form2.Show
fctSetParentWindow Form2.hwnd, MDIForm1.hwnd
End Sub
in a module:
Option Explicit
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewLong As Long) As Long
Public Const GWW_HWNDPARENT = (-8)
Public Function fctSetParentWindow(frmChildHwnd As Long, frmParentHwnd As Long) As Long
On Error Resume Next
fctSetParentWindow = SetWindowLong(frmChildHwnd, GWW_HWNDPARENT, frmParentHwnd)
If Err Then
'
End If
End Function
Best will be if you use a normal (not MDIChild) form and use the same function: fctSetParentWindow Form3.hwnd, MDIForm1.hwnd
Regards Xdream