Results 1 to 2 of 2

Thread: HELP

  1. #1

    Thread Starter
    Addicted Member icemanmt78's Avatar
    Join Date
    May 2000
    Posts
    142

    Unhappy

    Help,

    I need to get the PID number from the Windows NT Task manager for when Excel 97 loads up. I need this so i can terminate excel.

    I am using the following API code to get the PID number. This code uses the Excel class name which i think is wbatWClass. I am unable to kill excel as the api call to get the PID returns the wrong number.


    These two are meant to get me the correct PID BUT THEY GET ME THE WRONG ONE

    Code:
    Public Function FindWindowByClass(WindowClassName As String) As Long
        FindWindowByClass = FindWindow(WindowClassName, vbNullString)
    End Function
    
    
    Public Function FindProcessByWindowClass(WindowClassName As String) As Long
        Dim pid&
        GetWindowThreadProcessId FindWindowByClass(WindowClassName), pid&
        FindProcessByWindowClass = pid&
    End Function
    I am passing the value wbatWclass as the class name, is this correct

    HELP * i

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    The class name is "XLMAIN"
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width