Public Sub New(ByRef exePath As String, ByRef argurment As String) InitializeComponent() Dim info As ProcessStartInfo = New ProcessStartInfo(exePath, argurment) info.UseShellExecute = False info.CreateNoWindow = True info.RedirectStandardInput = False info.RedirectStandardOutput = False info.RedirectStandardError = False 'info.WindowStyle = ProcessWindowStyle.Hidden pro = System.Diagnostics.Process.Start(info) Try run: System.Threading.Thread.Sleep(500) SetParent(pro.MainWindowHandle, Me.panGuestMod.Handle) '<DllImport("user32.dll")> Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr End Function Nap(5000, False) 'Pauses program for 5 sec 'MessageBox.Show("Program only works if this message box is uncommented") GetClientRect(pro.MainWindowHandle, siz) '<DllImport("user32.dll")> Private Shared Function GetClientRect(ByVal HWND As IntPtr, ByRef LPRECT As Rectangle) As Boolean End Function me.Size = New Size(siz.Width, siz.Height) Catch ex As Exception MessageBox.Show(ex.ToString) GoTo run End Try End Sub
Try
Catch
GoTo
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)