There was a post here about the same problem that I have:
http://www.xtremevbtalk.com/showthread.php?t=272163
However, this problem was dealing with VB6 (I am using VB2010) and the code was much different. I tried but still couldn't figure out the right way.
Now I am trying to implement an EXE file (a rotating cube exe file) inside a form that can be open by a click. I don't want it to pop up a new window but instead inside a control box within a window (e.g a PictureBox control).
I have this code which can implement the notepad inside the form, but it cannot do that for the rotating cube exe file, it would pop up a new window.
Declare Auto Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Dim MyPSI As New ProcessStartInfo("notepad.exe")
Dim MyProcess As Process = Process.Start(MyPSI)
MyProcess.WaitForInputIdle()
SetParent(MyProcess.MainWindowHandle, Me.Handle)
I have spent hours and I'm still stuck on this. Any help would be much appreciate.
Thank you.