473,406 Members | 2,345 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,406 software developers and data experts.

enforce single instance of the app over a network

Hi,
I have an application that runs off a file server and can be accessed over the LAN network by 10+ machines.

I want to ensure that only one instance of the application run at any time over the entire network.

the "Previnstance" method does not work as it checks only on the local machine and not the network.

Also cannot create a check file which is deleted at close as the application has a tendency to crash at times.....
Aug 21 '12 #1
10 28287
Rabbit
12,516 Expert Mod 8TB
Use WMI to check the other machines to see which processes are running. Exit the program if it's already running on another machine. The users will need remote access to each other's computers and may need admin access to use WMI.

As a side note, you should probably fix the issue causing the crashes rather than working around it.
Aug 21 '12 #2
all machines do not have access to other machines......

can the previnstance method not be used at the server level????
Aug 23 '12 #3
Killer42
8,435 Expert 8TB
For that to work, I'd guess the application would have to be running on the server.
Aug 23 '12 #4
Rabbit
12,516 Expert Mod 8TB
PrevInstance only works on the local machine, it will not work for what you're trying to do. You could give the users access to the other machines if you want to use the WMI route. Perhaps if we knew why you had to do this, we could offer alternate methods of achieving the same effect.
Aug 23 '12 #5
Well the application was developed as a single user app and uses several ms access databases all on the same file server. Since then, we now have several people accessing the app but only one at a time over the LAN. (stand up and ask)
Need to make this foolproof by not allowing the app to run if another person is using it.

I rechecked and found that the database lock files (abc.ldb) also get deleted as soon as it crashes. so i should be able to check for presence of these files to open the app or not again.

Need to create a dummy database, and load that as soon as the splash form is loaded and then again as the MDI form loads??????
Let me try
Aug 25 '12 #6
yay, done,
loaded a dummy blank database on opening the application.
check for presence of lock file, on found exit with message.
and since it is a database, as soon as the application either closes or crashes, causes the lock file to be removed

wonder why i did not think of this before.
Aug 25 '12 #7
Rabbit
12,516 Expert Mod 8TB
Don't rely on the lock file too much, that's not fool proof either. There are bugs that can cause the lock file to not get deleted. It should work most of the time though. And if the off chance risk is acceptable, then it should work for your purpose. I still don't understand why more than one person can't be in there at the same time.
Aug 26 '12 #8
Killer42
8,435 Expert 8TB
For an application that was written to be single-user, this sounds like a neat solution. Of course it would be nicer if users could "play nice" and share the database, but failing that, this should do the trick (mostly).
Aug 26 '12 #9
this started as a simple order entry and invoicing system which has since then grown into a full product management and reporting and order entry and invoicing and bill of materials application with over 10 separate databases with about 100 tables and dozens of forms and hundreds of reports.

Now the only way to get it multiuser is to completely rewrite the software.

The (mostly) part is fine as everybody in the office knows the single user thing. As for the lock file not being deleted, can be deleted manually on checking that the application is not open on any pc.

Lets hope this works in the long run
Aug 27 '12 #10
Rabbit
12,516 Expert Mod 8TB
Access has support for multiple users without you having to do anything. What exactly happens if more than one person uses it at the same time?
Aug 27 '12 #11

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

Similar topics

2
by: Tom Kreyche | last post by:
I have an 3rd party app with VBA embedded, and I want to use it simply as a shell to call my C# application. This works fine using VBA's CreateObject("Shell.Application") and ShellExecute. ...
16
by: Elad | last post by:
Hi, I have an application that is made up of several executables. I need all these executables to use the same instance of an object. What is the best, most efficient way to approach this? ...
18
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the...
9
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to...
7
by: Jeffery Tyree | last post by:
I am writing an application in C#.NET that is "AlwaysOnTop" and there should only be one instance of this program running at any given time. The "AlwaysOnTop" piece is working just fine but I...
3
by: Mark Jerde | last post by:
VS 2005. When I google "CSharp single instance form" the returned pages usually use a Mutex or the VB.NET runtime library....
6
by: Jen | last post by:
I've implemented single-instance functionality in my .exe by using the mutex method. Works great. But when the .exe detects that it is not the first instance I want to bring the main window of...
3
by: sklett | last post by:
I suspect the answer might be in one of the words of my subject, but here goes anyway. I'm working on a system that will execute a very long (300+) chain of task objects. Here is some quick...
7
by: =?Utf-8?B?YWVzcGVy?= | last post by:
Is there such a thing as a single instance web service? Is it possible to have all calls to a web service share one property value by declaring it as static? I know web service should be stateless,...
5
by: Sarath | last post by:
I've to write a single instance class. there are different methods to control the single instance of a program. I've tried the following method class CSingleton { public: CSingleton&...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
0
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...

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.