killing excel.exe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhinav12345
    New Member
    • Aug 2008
    • 2

    killing excel.exe

    Hi All,

    I am using Excel.Applicati on object in my code. Now I would like to kill excel.exe created in the task manager.

    I am using window API function
    Declare Function GetWindowThread ProcessId Lib "user32.dll " _
    (ByVal hWnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer


    Now I am able to get the process ID of excel.exe when i run this code
    in a stand alone page.

    When I create a virtual directory and run the page from there,
    the process ids returned by this function is zero.

    Could anyone pls help.
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    are you using the process class ? and a .net language? because you can use process.getproc essesbyid method, or others in the class, and use the .kill() method or a safer method, like .closemainwindo w() or .close()?

    joedeene

    Comment

    • abhinav12345
      New Member
      • Aug 2008
      • 2

      #3
      Originally posted by joedeene
      are you using the process class ? and a .net language? because you can use process.getproc essesbyid method, or others in the class, and use the .kill() method or a safer method, like .closemainwindo w() or .close()?

      joedeene
      Hi joedeene,
      I am using the process class and the .kill method but in order to identify a
      process to kill , I need to know its process id.

      I am not able to identify this process id of excel.exe. If I get this process id then I can kill the excel.exe
      In order to get this process id I am using
      Declare Function GetWindowThread ProcessId Lib "user32.dll " _
      (ByVal hWnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer

      But when the application is put under a virtual directory and page is being run then process ids being returned by this function are 0.

      When page is being run by just right clicking on it and "view in browser", then
      process ids are returned.

      I am using <identity impersonate="tr ue"/> in my web.config

      Comment

      Working...