Share via


How to embed (dock) Third party EXE into Panel/form in vb .net

Question

Friday, October 21, 2011 6:27 AM

I need to write application in which I can embed (Dock) third party exe into panel witch I done partially with following

code-

<DllImport("user32.dll", SetLastError := True)>

Public Shared Function SetParent(hWndChild As IntPtr, hWndNewParent As IntPtr) As UInteger
End Function

Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click 

 System.Diagnostics.Process.Start("notepad")
Dim P As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("notepad")(0)
P.WaitForInputIdle()
SetParent(P.MainWindowHandle, Me.panel1.Handle)

End Sub

Problem-

  1. with this we can run third party exe into panel but not able to dock or feet it to panel

  2. can we embed all dialog generated by this process into panel

Thanks in advance

All replies (6)

Monday, October 24, 2011 8:38 AM âś…Answered

Hi Manoj,

Welcome to the MSDN Forum.

How about this way:

1.  get the new window handle.

2. Dock it in your application in the same way.

Best regards,

Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Friday, October 21, 2011 6:32 AM | 1 vote

Hello manoj : 

 

  Below is the article 

http://www.codeproject.com/KB/threads/applicationhost.aspx

 

Please check it .

Want to add MVP with my name.


Friday, October 21, 2011 6:47 AM

Thanks Sir

Your reply is really help full for me

this code helpful for me to Dock third party application into panel,

But i want to Embed/Dock all other windows also generated by this third party application into panel.

Let me clear it more

Suppose i dock "X" third party application into panel with the help of this code,

And on this "X" application there is command "New" witch launching new Window from this "X"

Application. I need to dock this new generated window also into same panel it should not go out side panel


Friday, October 21, 2011 12:24 PM

I would post your question to a Visual C# forum. This forum is for Visual Basic .NET.Paul ~~~~ Microsoft MVP (Visual Basic)


Friday, October 21, 2011 12:31 PM

Thanks sir for kind reply if i got anwser in visual basic also it will helpfull for me.


Saturday, October 22, 2011 4:43 AM

sir thanks for kind  reply

i updated sample code from C#.net to Vb.net

please if is there any way to achive help me in this