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. Monitoring Applications and Processes

Monitoring Applications and Processes

Scheduled Pinned Locked Moved C#
sysadminlearningcsharpvisual-studiodesign
5 Posts 4 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
    mphill4744
    wrote on last edited by
    #1

    Hello, I recently finished a C# course and I'm ready to create what could be a complex program, to me at least. The idea I have is to monitor a cad application that runs on the users machine and work on a design file locally but save it to the server every x number of minutes. Users currently work on the files on a blade server that backups are mediocre at best, a network running at 100 and not gigabit. After reading a few articles here on C# threads and processes I now have a few questions. Can C# monitor when the application starts\ends via the task manager and get the file path and name so I can then do a time\date compare with the version on the server vs. the one on the local machine? Anything to consider C# wise if a second instance of the application is started? They would be two different drawings and the task manager does show two applications and processes running. Can this be set as a service to launch, or what would be the best way to implement this once a user logs on to the machine to catch the start of the application? Should the FileSystemWatcher or EventHandler reduce the complexity? Any input or guides to an example already existing is appreciated. Or should I just stay with the "Hello World" example in the book? :doh: Thanks!

    I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon

    J B J 3 Replies Last reply
    0
    • M mphill4744

      Hello, I recently finished a C# course and I'm ready to create what could be a complex program, to me at least. The idea I have is to monitor a cad application that runs on the users machine and work on a design file locally but save it to the server every x number of minutes. Users currently work on the files on a blade server that backups are mediocre at best, a network running at 100 and not gigabit. After reading a few articles here on C# threads and processes I now have a few questions. Can C# monitor when the application starts\ends via the task manager and get the file path and name so I can then do a time\date compare with the version on the server vs. the one on the local machine? Anything to consider C# wise if a second instance of the application is started? They would be two different drawings and the task manager does show two applications and processes running. Can this be set as a service to launch, or what would be the best way to implement this once a user logs on to the machine to catch the start of the application? Should the FileSystemWatcher or EventHandler reduce the complexity? Any input or guides to an example already existing is appreciated. Or should I just stay with the "Hello World" example in the book? :doh: Thanks!

      I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon

      J Offline
      J Offline
      Jim Meadors
      wrote on last edited by
      #2

      You should always move beyond the "Hello World"! :)

      Jim Meadors

      1 Reply Last reply
      0
      • M mphill4744

        Hello, I recently finished a C# course and I'm ready to create what could be a complex program, to me at least. The idea I have is to monitor a cad application that runs on the users machine and work on a design file locally but save it to the server every x number of minutes. Users currently work on the files on a blade server that backups are mediocre at best, a network running at 100 and not gigabit. After reading a few articles here on C# threads and processes I now have a few questions. Can C# monitor when the application starts\ends via the task manager and get the file path and name so I can then do a time\date compare with the version on the server vs. the one on the local machine? Anything to consider C# wise if a second instance of the application is started? They would be two different drawings and the task manager does show two applications and processes running. Can this be set as a service to launch, or what would be the best way to implement this once a user logs on to the machine to catch the start of the application? Should the FileSystemWatcher or EventHandler reduce the complexity? Any input or guides to an example already existing is appreciated. Or should I just stay with the "Hello World" example in the book? :doh: Thanks!

        I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        You can try System.Diagnostics.Process.GetProcessesByName to get a list of Processes. But I do not know an event for a Process being started (perhaps WMI could do so), I'd poll the list every few seconds. But more important: how much interoperation does the application to be montired allow? Can you query its current file? Is the file read-able when it is opened in that application (could be locked!)?

        M 1 Reply Last reply
        0
        • B Bernhard Hiller

          You can try System.Diagnostics.Process.GetProcessesByName to get a list of Processes. But I do not know an event for a Process being started (perhaps WMI could do so), I'd poll the list every few seconds. But more important: how much interoperation does the application to be montired allow? Can you query its current file? Is the file read-able when it is opened in that application (could be locked!)?

          M Offline
          M Offline
          mphill4744
          wrote on last edited by
          #4

          The software does save changes automatically in the drawing which would be local in this case and then I would have it save the drawing to the server every 20 minutes. I did find a msdn topic on services http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.80).aspx[^] I think I may be on to something and I am testing it out. The reading of articles and implementing this is a bit like herding cats at the moment.

          I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon

          1 Reply Last reply
          0
          • M mphill4744

            Hello, I recently finished a C# course and I'm ready to create what could be a complex program, to me at least. The idea I have is to monitor a cad application that runs on the users machine and work on a design file locally but save it to the server every x number of minutes. Users currently work on the files on a blade server that backups are mediocre at best, a network running at 100 and not gigabit. After reading a few articles here on C# threads and processes I now have a few questions. Can C# monitor when the application starts\ends via the task manager and get the file path and name so I can then do a time\date compare with the version on the server vs. the one on the local machine? Anything to consider C# wise if a second instance of the application is started? They would be two different drawings and the task manager does show two applications and processes running. Can this be set as a service to launch, or what would be the best way to implement this once a user logs on to the machine to catch the start of the application? Should the FileSystemWatcher or EventHandler reduce the complexity? Any input or guides to an example already existing is appreciated. Or should I just stay with the "Hello World" example in the book? :doh: Thanks!

            I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            Steps - Learn how to create a windows service - Learn how to use Process - Figure out how to manage files and specifically detect time changes and how to copy. - Figure out how the cad app 'saves' a file Last step is more experimental. You should probably save two back ups and alternate as that gives a better chance of one not be bad due to a copy during a write. Last step also involves figuring out where the file is saved and to which user it belongs.

            mphill4744 wrote:

            Users currently work on the files on a blade server

            This of course is all dependent on the presumption that the 'server' is in fact windows.

            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