Application running

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maidenz08
    New Member
    • Sep 2007
    • 31

    Application running

    I am developing a very Basic licensing Software for a particular product. The product has already been developed and no changes can be made to the product now. So i have created my own exe that runs in the background and checks if the hardware dongle is connected. Only if the dongle is connected should that particular application open up. My queries are,

    1. How do i check if a particular exe is opened by the user.

    2. Can i Pause the running of the exe for some time, do my checks and resume the opening up of the exe after a while.

    Is this the right approach. Could someone shed more light on the same.

    Thanks in advance
  • IanWright83
    New Member
    • Apr 2009
    • 9

    #2
    Originally posted by Maidenz08
    I am developing a very Basic licensing Software for a particular product. The product has already been developed and no changes can be made to the product now. So i have created my own exe that runs in the background and checks if the hardware dongle is connected. Only if the dongle is connected should that particular application open up. My queries are,

    1. How do i check if a particular exe is opened by the user.

    2. Can i Pause the running of the exe for some time, do my checks and resume the opening up of the exe after a while.

    Is this the right approach. Could someone shed more light on the same.

    Thanks in advance
    1) You can using the Process class. Although there are all sorts of considerations, and generally I'd say if you're doing that sort of thing then you've wrongly designed your application.

    2) Not that I'm aware of.

    Honestly the moment you say you can't make changes to your product causes problems. Firstly can I recommend a system where you can make changes... what if a bug is found? If you can't roll those changes out....

    The ideal way to do this I think would be to have your licence application running, checking for the dongle. When the licence application starts, if it sees the dongle it creates a mutex. The product can then check to see if such mutex exists. If it does, continue executing. The licence app can then destroy the mutex once closed, or if the dongle is removed. Then the product can see this change next time it queries to see if the mutex exists and respond accordingly.

    Comment

    • Maidenz08
      New Member
      • Sep 2007
      • 31

      #3
      This is a tried and tested product which has been in the market for years and i can safely say it is bug free. The two developers who conceptualized and developed the product are the directors of the company and dont think will be able to dedicate time for any bit of coding or outsource it.

      I am currently using the process class but there are 5 different applications within the product which have the same process name. So that methodology wouldn't work right. Can i find the name of the exe that is running instead.

      Comment

      • IanWright
        New Member
        • Jan 2008
        • 179

        #4
        Originally posted by Maidenz08
        This is a tried and tested product which has been in the market for years and i can safely say it is bug free. The two developers who conceptualized and developed the product are the directors of the company and dont think will be able to dedicate time for any bit of coding or outsource it.

        I am currently using the process class but there are 5 different applications within the product which have the same process name. So that methodology wouldn't work right. Can i find the name of the exe that is running instead.
        No software is ever bug free regardless of how long it's been in the market... As I say the only really safe way to do this is via using Mutexes. You're never going to reliably do it using the Process class because you've got to consider other users running processes, more than 1 name (which you're already suffering from)...

        It's a very minor change to add in a mutex and get it working correctly, and is the most common way of doing this.

        Mutex mutex;

        Code:
        try
        {
           mutex = Mutex.OpenExisting("SINGLEINSTANCE");
           if (mutex!= null)
           {
              Console.WriteLine("Error : Only 1 instance of this application can run at a time");
              Application.Exit();
           }
        }
        catch (WaitHandleCannotBeOpenedException ex)
        {
           mutex  = new Mutex(true, "SINGLEINSTANCE");
        }

        Comment

        • Maidenz08
          New Member
          • Sep 2007
          • 31

          #5
          Thanks a lot for your reply Ian.. But i cannot make changes to the current product. Thats the requirement.. It wouldnt be a challenge if we were to make code changes in the existig product itself.

          It would be great if you could tell me how to check if a particular exe is running without getting into the process class.

          Comment

          • IanWright
            New Member
            • Jan 2008
            • 179

            #6
            Originally posted by Maidenz08
            Thanks a lot for your reply Ian.. But i cannot make changes to the current product. Thats the requirement.. It wouldnt be a challenge if we were to make code changes in the existig product itself.

            It would be great if you could tell me how to check if a particular exe is running without getting into the process class.
            Well if you're processes have the same name, then obviously you're not going to be able to distinguish between them. And you've said you can't change code to use Mutexes.

            I'm not sure there's anything else you can do, at least with the .NET framework. I'm not sure if you might be able to get any further with Reflection or not...

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              Take a look at Aladdin's HASP software.
              It acts as a wrapper around existing software, which sounds like your need.
              You can then add things to that envelope like time-trial limitations etc.

              Comment

              Working...