Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Processes

Processes

Scheduled Pinned Locked Moved Visual Basic
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cwayman
    wrote on last edited by
    #1

    Hey, Is there a way to check if an application is running in the Task Manager? and if it is kill it before starting my own custom process? I have the following function which sends a file to a printer but it opens up the application (e.g. MS Word) and sends the print command before closing it again.

    Private Sub SendFileToPrinter()

        Dim startinfo As New ProcessStartInfo
        startinfo.FileName = strFullFilePath
    
        startinfo.Verb = "print"
        startinfo.WindowStyle = ProcessWindowStyle.Hidden
    
        Process.Start(startinfo)
    
    End Sub
    

    The problem is that sometimes it doesnt exit the application fully and it is still running in the background. Is the a way to get the location of the application .exe file that is running from the MIME type of the file, and then close it? thanks for your help Chris

    C 1 Reply Last reply
    0
    • C cwayman

      Hey, Is there a way to check if an application is running in the Task Manager? and if it is kill it before starting my own custom process? I have the following function which sends a file to a printer but it opens up the application (e.g. MS Word) and sends the print command before closing it again.

      Private Sub SendFileToPrinter()

          Dim startinfo As New ProcessStartInfo
          startinfo.FileName = strFullFilePath
      
          startinfo.Verb = "print"
          startinfo.WindowStyle = ProcessWindowStyle.Hidden
      
          Process.Start(startinfo)
      
      End Sub
      

      The problem is that sometimes it doesnt exit the application fully and it is still running in the background. Is the a way to get the location of the application .exe file that is running from the MIME type of the file, and then close it? thanks for your help Chris

      C Offline
      C Offline
      Carlos Cruz Espino
      wrote on last edited by
      #2

      This is what I've done. I hope it works to you. Private Sub KillProcess() procesos = Process.GetProcesses Dim p As Process For Each p In procesos If (p.ToString.LastIndexOf(nameOfProcessToKill) > 0) Then p.kill() Exit Sub End If Next End Sub E-mail me back would you? Regards, Carlos F chile

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups