vbMarkO
asked on
Can this be done An app1 open and display app2 within app1 form?
Is it possible to open another app within an app? Does that make sense?
I mean could one actually make another application appear within a container within a main app?
Mark
I mean could one actually make another application appear within a container within a main app?
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Idle_Mind,
Oh man this is very cool, no doubt what I am looking for I think....
not clear on one thing here using the below code which worked perfectly by the way ...
Public Class Form1
Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private p As Process = Nothing
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (p Is Nothing) OrElse p.HasExited Then
p = Process.Start("Calc")
p.WaitForInputIdle()
SetParent(p.MainWindowHand le, Panel1.Handle)
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormC losingEven tArgs) Handles Me.FormClosing
If Not (p Is Nothing) Then
If Not p.HasExited Then
p.CloseMainWindow() ' or p.Kill() if it doesn't have a GUI
End If
End If
End Sub
End Class
This opened the calc ... but how would I aim this at a different app .... is it here in this line of code
p = Process.Start("Calc")
Calc <----- is this where I would put path to exe file of app I wish to open up?
Mark
Oh man this is very cool, no doubt what I am looking for I think....
not clear on one thing here using the below code which worked perfectly by the way ...
Public Class Form1
Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Private p As Process = Nothing
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (p Is Nothing) OrElse p.HasExited Then
p = Process.Start("Calc")
p.WaitForInputIdle()
SetParent(p.MainWindowHand
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormC
If Not (p Is Nothing) Then
If Not p.HasExited Then
p.CloseMainWindow() ' or p.Kill() if it doesn't have a GUI
End If
End If
End Sub
End Class
This opened the calc ... but how would I aim this at a different app .... is it here in this line of code
p = Process.Start("Calc")
Calc <----- is this where I would put path to exe file of app I wish to open up?
Mark
ASKER
I answered that question I just opened up another app and it worked great .... May I ask another question or 2 understand your answer is the accepted solution and I will accept your solution as soon as I am done typing here.
Follow up questions if I might;
1. Is there a way to constrain the app I am opening in a fixed position within the panel?
2. Also is it possible to make my app resize to accommodate the opened app?
Note: Should I just be posting new questions .... if so I am more than happy because my original question has been solved ..
Thanx
Follow up questions if I might;
1. Is there a way to constrain the app I am opening in a fixed position within the panel?
2. Also is it possible to make my app resize to accommodate the opened app?
Note: Should I just be posting new questions .... if so I am more than happy because my original question has been solved ..
Thanx
ASKER
Idle_Mind ...
Here is my new questions concerning this I invite you to answer
https://www.experts-exchange.com/questions/22486758/Modify-this-code-to-Constrain-app-within-a-fixed-position-within-panel-it-opens-an-app-within-an-app.html
Here is my new questions concerning this I invite you to answer
https://www.experts-exchange.com/questions/22486758/Modify-this-code-to-Constrain-app-within-a-fixed-position-within-panel-it-opens-an-app-within-an-app.html
Use the WebBrowser control - add an instance of the control to your form, and use the .Navigate
method to open your word document - It works just like the old OLE container did.