View Single Post
  #5  
Old 08-05-2003, 08:08
bbolte
Guest
 
Posts: n/a
Default

here is how i was able to get the process to terminate. i changed my close corel sub procedure to use WMI:

Code:
Private Sub StopCorel()
    '// close the the document
    With Application.ActiveDocument
        .Dirty = False
        .Close
    End With
    '// check to make sure no other documents open
    '// if not close corel draw
    If coreldraw.Application.Documents.Count = 0 Then
        IsProcessRunning ".", "coreldrw.exe"
    End If
End Sub

Private Sub IsProcessRunning(strServer As String, strProcess As String)
    Dim Process As Variant, strObject As SWbemServices

    Set strObject = GetObject("winmgmts://" & strServer)

    ' Call always gets only one Win32_ComputerSystem object
    For Each Process In strObject.InstancesOf("Win32_Process")
        If UCase(Process.Name) = UCase(strProcess) Then
            '// quit corel
            Process.Terminate
            Exit Sub
        End If
    Next
End Sub
works pretty groovy.
Reply With Quote