473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Application running

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
May 12 '09 #1
6 1575
@Maidenz08
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.
May 12 '09 #2
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.
May 12 '09 #3
IanWright
179 100+
@Maidenz08
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;

Expand|Select|Wrap|Line Numbers
  1. try
  2. {
  3.    mutex = Mutex.OpenExisting("SINGLEINSTANCE");
  4.    if (mutex!= null)
  5.    {
  6.       Console.WriteLine("Error : Only 1 instance of this application can run at a time");
  7.       Application.Exit();
  8.    }
  9. }
  10. catch (WaitHandleCannotBeOpenedException ex)
  11. {
  12.    mutex  = new Mutex(true, "SINGLEINSTANCE");
  13. }
  14.  
May 12 '09 #4
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.
May 12 '09 #5
IanWright
179 100+
@Maidenz08
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...
May 12 '09 #6
tlhintoq
3,525 Expert 2GB
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.
May 13 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Dmitry Karneyev | last post by:
Hi! I guess this question have been asked a lot of times, but please be tolerant and if you have any ideas share it. The question is: how to make availibale only one instance of application and...
4
by: Chuck | last post by:
Hello everybody, I need to abort execution during start up, while the constructor called by Application.Run is executing. If the database fails to connect during my application's startup I...
21
by: Chris | last post by:
I'm trying to get an existing VS.NET project up on my Win2003 server and I get the following error (on the actual website page): "It is an error to use a section registered as...
8
by: mike2036 | last post by:
I have an application (that has unmanaged code) and when I launch it without 'FullTrust' permissions (LocalIntranet_Zone), it crashes. When I set 'FullTrust' permissions, it launches fine. Is...
8
by: Bryan | last post by:
Does anyone have an example of an application that can connect to a running process and capture Trace.WriteLine calls like in SQL Server Profiler? I know that we can inherit from a TraceListener...
1
by: whitehorse | last post by:
When the warehousecontroller service is invoked, the following error message is sent to the application log: Event Type: Error Event Source: TFS Warehouse Event Category: None Event ID: 3000...
4
by: casper | last post by:
Hi, I created an asp.net 2.0 website with VWD and made it an application in IIS. It was created on a ntfs disc (my documents...). The directory permissions are set on 'anonymous allowed' using...
7
by: Aryan | last post by:
Hi Everybody, I am facing "Server Application Unavailable" problem with .NET Framework 2.0 Earlier Framework was working fine, but one fine day it stopped working for particular application....
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.