| | | StrataFrame User
       
Group: StrataFrame Users Last Login: 2 days ago @ 4:06:22 PM Posts: 313, Visits: 1,274 |
| | I am calling a VB6 ActiveX exe from my VB.NET application. It seems to work okay except I when I exit the program the executable is still running in the workstation processes. Here is the code used. Dim AvRebuild as New RebuildUtility.clsRebuild()AvRebuild.StartXRebuild(......) I launch a number of other VB6 exe's using System.Diagnostics.Process, where I can add a handler so I can remove the process in the OnProcessExit event. Is there something similar for ActiveX exe's? Thanks Tim |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 5:04:58 PM Posts: 4,780, Visits: 4,744 |
| You can do this several ways...each process that is started has a unique process ID (PID) that you can capture, or if you are only going to have one instance on the machine you can just use the code below and close down all processes of that type. The below code you would add in the FormClosing event (or something of that nature) in your main MDI window.Dim loProcess As System.Diagnostics.Process For Each loProcess IN System.Diagnostics.Process.GetProcessByName("MyProcessName") Try loProcess.Kill() Catch ex As Exception End Try Next Note: You DO NOT provide the extension of the process name. Just name prefix. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 2 days ago @ 4:06:22 PM Posts: 313, Visits: 1,274 |
| | Is it possible to trap the process ID based on how I am launching the application or can you only do this using System.Diagonstics.Process? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 5:04:58 PM Posts: 4,780, Visits: 4,744 |
| | Well, I assume that since you are talking to the ActiveX control, the ActiveX control is the one launching the process. If this is the case, then you are going to have to cycle through the processes. If you launch a process directly then you have more control over capturing the PID. |
| |
|
|