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. Get object property from running process

Get object property from running process

Scheduled Pinned Locked Moved C#
securitytutorial
6 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.
  • S Offline
    S Offline
    Shaun Becker
    wrote on last edited by
    #1

    I am writing a logistics application suite. It will have a main program, a maintenance program, an order entry program, and an admin program. The main program will just control security while all other applications are running. Whenever any of the other programs start up, first it is going to check if there is already an instance of the application running using System.Diagnostics.Process.GetProcessesByName(). If there is then it will just activate that instance. If there isn't then it will then check if there is an instance of the main application using System.Diagnostics.Process.GetProcessesByName(). If there is an instance of the main application, then it will just get a reference to the user object from the main program. If there isn't an instance of the main application, then it will create a new process of the main application with System.Diagnostics.Process.Start(), which will require the user to log in and that will intialize the user object. Then the executing program will get a reference to the user object from the main program that was just started. I hope this explains everything I am trying to do. If you have any suggestions on how to do this or of a better way to reach the desired outcome, I would greatly appreciate it. Thanks Shaun

    R 1 Reply Last reply
    0
    • S Shaun Becker

      I am writing a logistics application suite. It will have a main program, a maintenance program, an order entry program, and an admin program. The main program will just control security while all other applications are running. Whenever any of the other programs start up, first it is going to check if there is already an instance of the application running using System.Diagnostics.Process.GetProcessesByName(). If there is then it will just activate that instance. If there isn't then it will then check if there is an instance of the main application using System.Diagnostics.Process.GetProcessesByName(). If there is an instance of the main application, then it will just get a reference to the user object from the main program. If there isn't an instance of the main application, then it will create a new process of the main application with System.Diagnostics.Process.Start(), which will require the user to log in and that will intialize the user object. Then the executing program will get a reference to the user object from the main program that was just started. I hope this explains everything I am trying to do. If you have any suggestions on how to do this or of a better way to reach the desired outcome, I would greatly appreciate it. Thanks Shaun

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #2

      Since it is different applications using different AppDomains, you will probably want to go with a remoting singleton object. That would allow you to share the single instance between the applications. You could spin off an invisible WinApp UserData server module that will host your remote object. The UserData object could have a reference counter property to track how many client connections it currently has. When an application starts, if the UserData server is not in the proccess list, then it would start the UserData server, and call the UserData member to display and validate the login. Of course, if the server is already running then it does not do the login since the login has already occured and the UserData object will have your login instance. After the server is confirmed to be running, the program that was launched would remote connect to the UserData object and increment the ref count. When a application is closing, it decay the ref counter by one and if it is zero, it would trigger the UserData server to close. Rocky Moore <><

      S 1 Reply Last reply
      0
      • R Rocky Moore

        Since it is different applications using different AppDomains, you will probably want to go with a remoting singleton object. That would allow you to share the single instance between the applications. You could spin off an invisible WinApp UserData server module that will host your remote object. The UserData object could have a reference counter property to track how many client connections it currently has. When an application starts, if the UserData server is not in the proccess list, then it would start the UserData server, and call the UserData member to display and validate the login. Of course, if the server is already running then it does not do the login since the login has already occured and the UserData object will have your login instance. After the server is confirmed to be running, the program that was launched would remote connect to the UserData object and increment the ref count. When a application is closing, it decay the ref counter by one and if it is zero, it would trigger the UserData server to close. Rocky Moore <><

        S Offline
        S Offline
        Shaun Becker
        wrote on last edited by
        #3

        Do you have a code example of what you are talking about, because I am not quite sure how to implement what you are talking about? Thanks

        R 1 Reply Last reply
        0
        • S Shaun Becker

          Do you have a code example of what you are talking about, because I am not quite sure how to implement what you are talking about? Thanks

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          Yeah, I can through together a little sample for you tonight. Just heading to bed at the moment, but will e-mail it to you later tonight. Rocky Moore <><

          S 1 Reply Last reply
          0
          • R Rocky Moore

            Yeah, I can through together a little sample for you tonight. Just heading to bed at the moment, but will e-mail it to you later tonight. Rocky Moore <><

            S Offline
            S Offline
            Shaun Becker
            wrote on last edited by
            #5

            Thank you very much, it worked perfectly. I really appreciate your help. Shaun

            R 1 Reply Last reply
            0
            • S Shaun Becker

              Thank you very much, it worked perfectly. I really appreciate your help. Shaun

              R Offline
              R Offline
              Rocky Moore
              wrote on last edited by
              #6

              Your welcome, glad I could be of help! Rocky Moore <><

              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