Using VB6 ActiveX exe's from VB.NET


Author
Message
Tim Dol
Tim Dol
StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
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

 


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.

Tim Dol
Tim Dol
StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
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?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.
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