Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Private hWnd As Long = 0
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
If hWnd = 0 Then
hWnd = FindWindow("Tfrm_ifc_view", Nothing)
If hWnd <> 0 Then
SetParent(hWnd, Me.Panel1.Handle)
SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End If
else
SetParent(hWnd, nothing)
hWnd = 0
end if
End Sub