473,809 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application running

Maidenz08
31 New Member
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 1596
IanWright83
9 New Member
@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
Maidenz08
31 New Member
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 New Member
@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
Maidenz08
31 New Member
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 New Member
@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 Recognized Expert Specialist
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
4672
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 if second one is loaded it must be close and give focus to first one. Thanks for any advice! Dmitry
4
11170
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 want to display a message (no problem here) and then abort the program. However, after the attached code executes I end up with my main form and a wait cursor! If I click on the X the form closes. Boss doesn't think an unhandled exception will...
21
2183
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 allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." I've been told by the previous developer that the website needs to be set as a "application". I...
8
6053
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 there a way I can compile the application such that it won't even attempt to launch without correct permissions instead of just crashing? Thanks for any help. -Mike
8
2151
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 class to write to files, databases, etc..., but I would really like to attach to running .NET processes and get the results without any logging and instead capture the real-time results when troubleshooting.
1
2453
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 Date: 4/14/2006 Time: 2:41:08 PM User: N/A
4
5049
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 IUSR_MYSERVER, which has read/list permissions to the apllication directory. When i start it from the browser, i get this error: Server Application Unavailable
7
1131
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. Where as other application running under framework 2.0 is working fine. Giving you all error discription generated by my application(i am using
15
7093
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 every second. I remote desktop to the computer hosting this application and run the application. It starts up and displays the counter incrementing every second. If I disconnect the network cable between the two computers for 10 seconds and...
4
4532
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 child apps of an IIS application and can be used by multiple users during the application life cycle and for multiple page loads for the same or different page under a root application. What I don't understand and need to know is whether that...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.