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. Path of running application.

Path of running application.

Scheduled Pinned Locked Moved C#
help
11 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.
  • U Offline
    U Offline
    User 4041985
    wrote on last edited by
    #1

    Hi, i need path of all running application. if we have two ms-word doc file, so how i can find path of this two file. i find path of notepad using ManagementClass MgmtClass = new ManagementClass("Win32_Process"); and CommandLine property. it gives only path of notepad allpication only, but not work in the case of word,xls file. plz help me

    A D 2 Replies Last reply
    0
    • U User 4041985

      Hi, i need path of all running application. if we have two ms-word doc file, so how i can find path of this two file. i find path of notepad using ManagementClass MgmtClass = new ManagementClass("Win32_Process"); and CommandLine property. it gives only path of notepad allpication only, but not work in the case of word,xls file. plz help me

      A Offline
      A Offline
      Anthony Mushrow
      wrote on last edited by
      #2

      Im not sure you will be able to, after a program loads a file, it's usually stored in memory until the user saves it. Each application will probably have some variable somewhere which stores the location of the file (so when you click save it knows where to stick the data) but i don't think you'll be able to access it.

      My current favourite word is: Bacon!

      -SK Genius

      1 Reply Last reply
      0
      • U User 4041985

        Hi, i need path of all running application. if we have two ms-word doc file, so how i can find path of this two file. i find path of notepad using ManagementClass MgmtClass = new ManagementClass("Win32_Process"); and CommandLine property. it gives only path of notepad allpication only, but not work in the case of word,xls file. plz help me

        D Offline
        D Offline
        Derek Bartram
        wrote on last edited by
        #3

        Could you clarify the question, I don't really understand what you are trying to do. System.Environment.CurrentDirectory and System.Reflection.Runtime.Process would both be worth a look though I think.

        U 1 Reply Last reply
        0
        • D Derek Bartram

          Could you clarify the question, I don't really understand what you are trying to do. System.Environment.CurrentDirectory and System.Reflection.Runtime.Process would both be worth a look though I think.

          U Offline
          U Offline
          User 4041985
          wrote on last edited by
          #4

          hi Derek, Thanks for your quick reply. i need physical location and size of all application, which is running. have you seen task manager control panel.whatever the application running under applications tab.i need physical location and size of all application. thanks in anticipation. balram mallick

          D 1 Reply Last reply
          0
          • U User 4041985

            hi Derek, Thanks for your quick reply. i need physical location and size of all application, which is running. have you seen task manager control panel.whatever the application running under applications tab.i need physical location and size of all application. thanks in anticipation. balram mallick

            D Offline
            D Offline
            Derek Bartram
            wrote on last edited by
            #5

            foreach (Process p in System.Diagnostics.Process.GetProcesses()) {

            Member 4044988 wrote:

            physical location

            System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName

            Member 4044988 wrote:

            size of application

            FileInfo class will give you that once you have the FileName }

            U 1 Reply Last reply
            0
            • D Derek Bartram

              foreach (Process p in System.Diagnostics.Process.GetProcesses()) {

              Member 4044988 wrote:

              physical location

              System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName

              Member 4044988 wrote:

              size of application

              FileInfo class will give you that once you have the FileName }

              U Offline
              U Offline
              User 4041985
              wrote on last edited by
              #6

              Hi Derek, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName gives the path of main module. means if you have opened ms -word doc "abc.doc" ,then the code which you have provided will give the path pf winword.exe. it will not give the path of "abc.doc". i need path of "abc.doc", not the path of winword.exe. now as i think requirement is clear to you. once again thanks for your reply. Balram mallick

              D 1 Reply Last reply
              0
              • U User 4041985

                Hi Derek, System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName gives the path of main module. means if you have opened ms -word doc "abc.doc" ,then the code which you have provided will give the path pf winword.exe. it will not give the path of "abc.doc". i need path of "abc.doc", not the path of winword.exe. now as i think requirement is clear to you. once again thanks for your reply. Balram mallick

                D Offline
                D Offline
                Derek Bartram
                wrote on last edited by
                #7

                That's VERY difficult. I'll have a think, however I seriously doubt i'll be able to do that. Do you need the path of the open file for all applications (e.g. internet explorer, notepad, etc., or just word)

                U 1 Reply Last reply
                0
                • D Derek Bartram

                  That's VERY difficult. I'll have a think, however I seriously doubt i'll be able to do that. Do you need the path of the open file for all applications (e.g. internet explorer, notepad, etc., or just word)

                  U Offline
                  U Offline
                  User 4041985
                  wrote on last edited by
                  #8

                  yes, now you are getting the point.if you will able to help me that will be really appreciable.Thanks for your co-operation. balram

                  D 1 Reply Last reply
                  0
                  • U User 4041985

                    yes, now you are getting the point.if you will able to help me that will be really appreciable.Thanks for your co-operation. balram

                    D Offline
                    D Offline
                    Derek Bartram
                    wrote on last edited by
                    #9

                    I don't know how you'd do it for all applications, however for office applications there is a specific programming api. Have a look in there. The only other piece of information I can suggest is watching disk activity; there are certainly applications out there that show which processes are accessing which files. That's the best I can do i'm afraid, sorry and good luck, Derek Bartram.

                    U 1 Reply Last reply
                    0
                    • D Derek Bartram

                      I don't know how you'd do it for all applications, however for office applications there is a specific programming api. Have a look in there. The only other piece of information I can suggest is watching disk activity; there are certainly applications out there that show which processes are accessing which files. That's the best I can do i'm afraid, sorry and good luck, Derek Bartram.

                      U Offline
                      U Offline
                      User 4041985
                      wrote on last edited by
                      #10

                      hi derek do you have any idea that how i can get path of office applications. i am not getting the api which can show the path of office application.

                      D 1 Reply Last reply
                      0
                      • U User 4041985

                        hi derek do you have any idea that how i can get path of office applications. i am not getting the api which can show the path of office application.

                        D Offline
                        D Offline
                        Derek Bartram
                        wrote on last edited by
                        #11

                        Member 4044988 wrote:

                        do you have any idea that how i can get path of office applications.

                        None at all, sorry.

                        Member 4044988 wrote:

                        i am not getting the api which can show the path of office application.

                        http://www.microsoft.com/downloads/details.aspx?FamilyId=135F4D99-F480-4A81-AF8F-F6E4896611E2[^], I'm refering to this (and obviously the 2007 version as well).

                        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