| How to detect MapPoint process
douglas, what I do in those cases is use a small routine that detects whether there is an MP process currently running, and if it is, then I programmatically close it. This has one catch though: it will close all MP processes, this means that if you have a MP window open because you separately opened it to use it yourself, not a program, then it wil try to close it. I think some fine tuning of the method could solve this problem, but it should work for most scenarios:
Private Sub KillMapPointProcess()
Dim proc As New Process()
Dim procs As Process()
Dim i As Integer
procs = proc.GetProcessesByName("MapPoint")
If procs.Length = 0 Then Return 'MP wasn't loaded, so return
For i = 0 To UBound(procs)
procs(i).Kill()
procs(i).WaitForExit()
Next
End Sub
Basically what this does is to get a list of all the running processes that are called "MapPoint", and for each and every one of them, it starts closing them. It does so with all processes because at that point you wouldn't have a way to determine which one is the stuck one (I think).
Let me know if it works. |