VB.NET example code for calling other exe to act like as MDI child form? is it possible?-Collection of common programming errors
ok here is the scenario. 1. i’ve create a project that has 1 form named form1.exe 2. i’ve also create a project that has 1 MDI form.
in this MDI Form. i’would like to call “form1.exe” act like / behave like MDI Form child. i’ve tried using this code :
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndParent As IntPtr) As IntPtr
End Function
Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click, NewToolStripButton.Click, NewWindowToolStripMenuItem.Click
Dim myProcess As Process = New Process()
myProcess.StartInfo.FileName = "D:\tesVB.exe"
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
myProcess.Start()
myProcess.WaitForInputIdle()
SetParent(myProcess.MainWindowHandle, Me.Handle)
myProcess.WaitForExit()
End Sub
Above code is worked but that new child form(form1.exe) doesn’t act like it should be! When i maximized or minimized it. it don’t act like MDI Child Form.
Can anyone give me another better example code ? thx before.