Hosting a VFP App


Author
Message
Troy Murphy
Troy Murphy
StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)StrataFrame Beginner (12 reputation)
Group: Forum Members
Posts: 12, Visits: 1.1K

I am trying to host an VFP application (MDI application withing the _screen) in .NET.

What am I doing wrong below?  When I run this and step into the Process.Start method, everything works fine.  However, when I run the code without a break-point, the VFP Application is not hosted.

A second question is: What would be the best practice in managing the process?  In other words: I would like the hosted application to terminate when the .NET app is exited.  Currently, unless I close the VFP app 1st, it is left in the running process collection (task manager).

 

Private Sub DocMgrToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DocMgrToolStripMenuItem.Click

Dim AppPath As String = "c:\MyVfpAppFolder\"

Dim App2Run As String = "MyGreatFoxProApp.exe"

Dim loStart As New System.Diagnostics.ProcessStartInfo(AppPath + App2Run)

loStart.WindowStyle = Diagnostics.ProcessWindowStyle.Normal

'loStart.UseShellExecute = False

loStart.WorkingDirectory = AppPath

Dim oProcess As System.Diagnostics.Process = System.Diagnostics.Process.Start(loStart)

'oProcess.WaitForInputIdle(3000)

Do While oProcess.MainWindowHandle.ToInt32() = 0

Loop

Dim lnHandle As Integer = oProcess.MainWindowHandle.ToInt32()

SetParent(lnHandle, Me.Handle)

End Sub


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search