locked
Getting process running when user is not administrator RRS feed

  • Question

  • Hello,

      I have created a VB.NET application.

      I want only one instance of application to be running on one machine at a time.

      It worked with Process.getCurrentProcess and checking FilePrivatePart of Module\FileVersion\

      For accessing the process class User on that machine needs to be an administrator.

      But my application is runned even though user is not administrator.

      Could any let me know how to solve this.

      One more thing user can copy the exe to another and run also..

    Regards
    Amit Pandya
    Wednesday, August 3, 2005 1:29 AM

Answers

  • This sounds like a Windows Service to me. Windows Services can be set to run at startup or on first request. You can specify the account to run the service under. There is only one instance on the machine. Lastly you can easily write them in .NET. Check out the Windows Service project in VS.NET.

    http://msdn.microsoft.com/msdnmag/issues/01/12/NETServ/
    Friday, August 5, 2005 6:02 AM

All replies

  • Check out multiple-instance detection in Genghis (http://www.genghisgroup.com) using the InitialInstanceActivator class. It should work under both admin and non-admin accounts. It uses .NET Remoting to communicate between multiple instances and ensure that only one is running. (You might want to communicate to let the first instance know which document you were trying to open, a la Microsoft Word.) There is a sample project called SingleInstance, which demonstrates the technique.

    If you don't need to communicate between instances, you can also try to acquire a named Mutex. If you fail to acquire the mutex, another instance of your app must be running and you can simply exit. This technique also works under non-admin privileges.
    Wednesday, August 3, 2005 6:00 AM
  • Hello James,

      Thanks for the link it was helpful to some extend.

      But in this there can be multiple instances of multiple user of the same machine.

      I wanted only one instance in one machine either it is an Admin,
      Guest or anyother.

      The application can be started only once in this system.

      Any ideas.

    Regards
    Amit Pandya

    Friday, August 5, 2005 5:08 AM
  • This sounds like a Windows Service to me. Windows Services can be set to run at startup or on first request. You can specify the account to run the service under. There is only one instance on the machine. Lastly you can easily write them in .NET. Check out the Windows Service project in VS.NET.

    http://msdn.microsoft.com/msdnmag/issues/01/12/NETServ/
    Friday, August 5, 2005 6:02 AM