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. C#
  4. Closing the curent process

Closing the curent process

Scheduled Pinned Locked Moved C#
help
3 Posts 3 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.
  • M Offline
    M Offline
    mrithula8
    wrote on last edited by
    #1

    Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'

    L L 2 Replies Last reply
    0
    • M mrithula8

      Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      System.Diagnostics.Process.GetCurrentProcess() IS USED FOR GETTING CURRENT PROCESS. AND Process.kill() IS USED FOR KILLING PROCESS.

      mailto: anubhava.prodata@gmail.com

      1 Reply Last reply
      0
      • M mrithula8

        Hi I used the following code to close the running processes.When i click on the stop button i want to stop all those files that are opened.<pre> currpro = Process.GetCurrentProcess(); foreach (Process proce in currpro) { proce.CloseMainWindow(); }It says, Error 1 foreach statement cannot operate on variables of type 'System.Diagnostics.Process' because 'System.Diagnostics.Process' does not contain a public definition for 'GetEnumerator'

        L Offline
        L Offline
        Luc 648011
        wrote on last edited by
        #3

        MSDN on Process.GetCurrentProcess() says: Gets a new Process component and associates it with the currently active process. I can see no plural form anywhere, so why use foreach? :)

        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