I am placing an external program into my application. The current code is as follows:
Btw: I know I have lots of unused functionsCode:Const SW_HIDE As Integer = 0 Const SW_SHOWNORMAL As Integer = 1 Const SW_NORMAL As Integer = 1 Const SW_SHOWMINIMIZED As Integer = 2 Const SW_SHOWMAXIMIZED As Integer = 3 Const SW_MAXIMIZE As Integer = 3 Const SW_SHOWNOACTIVATE As Integer = 4 Const SW_SHOW As Integer = 5 Const SW_MINIMIZE As Integer = 6 Const SW_SHOWMINNOACTIVE As Integer = 7 Const SW_SHOWNA As Integer = 8 Const SW_RESTORE As Integer = 9 Const SW_SHOWDEFAULT As Integer = 10 Const SW_FORCEMINIMIZE As Integer = 11 Const SW_MAX As Integer = 11 <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Shared Function FindWindow( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As IntPtr End Function Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr,ByVal hWndNewParent As System.IntPtr) As System.IntPtr Private Sub Emulator_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim MyPSI As New ProcessStartInfo("notepad.exe") Dim MyProcess As Process = Process.Start(MyPSI) MyProcess.WaitForInputIdle() Dim hWnd As IntPtr hWnd = MyProcess.MainWindowHandle SetParent(hWnd, Me.Handle) Me.Text = MyProcess.MainWindowTitle End Sub
What I want is for "notepad" to open up maximized and without a border. I already have it maximized, but I want the border gone.
How can I do this?
Also how can I make my current form the same size as the process?





Reply With Quote