Imports System.Runtime.InteropServices Public Class Form1 Private Const WM_SYSCOMMAND As Integer = 274 Private Const SC_MAXIMIZE As Integer = 61488 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 Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim proc As Process proc = Process.Start(Notepad.exe) proc.WaitForInputIdle() SetParent(proc.MainWindowHandle, Me.Panel1.Handle) SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) proc = Process.Start(Calc.exe) proc.WaitForInputIdle() SetParent(proc.MainWindowHandle, Me.Panel2.Handle) SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) proc = Process.Start(Wordpad.exe) proc.WaitForInputIdle() SetParent(proc.MainWindowHandle, Me.Panel3.Handle) SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) proc = Process.Start(Freecell.exe) proc.WaitForInputIdle() SetParent(proc.MainWindowHandle, Me.Panel4.Handle) SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) End Sub End Class ========================================================================== Imports System.Runtime.InteropServices Imports System.IntPtr Public Class Form1 Dim a As IntPtr _ Private Shared Function FindWindowByCaption( _ ByVal zero As IntPtr, _ ByVal lpWindowName As String) As IntPtr End Function ` _ `Private Shared Function ShowWindowAsync(ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Boolean `End Function Enum ShowWindowCommands As Integer ``` ``` Hides the window and activates another window. ``` Hide = 0 ``` ``` Activates and displays a window. If the window is minimized or ``` maximized, the system restores it to its original size and position. ``` An application should specify this flag when displaying the window ``` for the first time. ``` Normal = 1 ``` ``` Activates the window and displays it as a
©