Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two or more session

Status
Not open for further replies.

MontyItaly

Programmer
Feb 5, 2013
23
IT
The answer to this question I had already seen but can not find it anymore.
I have to find if a user has multiple sessions open the same program. To do the upgrade.
Thanks

Monty
 
I would say no. It's not my thread.
A user launches the exe, I put online update, the user raises the exe but the update fails to copy the new version on the open file.
I have to figure out if the program is already open.
 
There are many ways to do that. If you applied something, you should find it in your own code, shouldn't you?

You can see what processes are running via Windows API or WMI Scripting, you can use the singleton pattern and close your application at start, if it fins out it's already running.

Search for single/one instance.
Eg faq184-1998

Bye, Olaf.
 
The method I use is the one mentioned by Olaf in faq184-1998. But be aware that it relies on the main screen having a predictable title, although that's rarely a problem.

Also, you've got to ask yourself if you really do need to prevent a second instance. In some apps, that will be essential, but not always. I've noticed that users sometimes appreciate the ability to open multiple instances (just as I do with the apps that I work with).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you all.
I have to prevent the second instance only to update the procedure. Normally users open many instances without any problems.
I think working on the 'PROCEDURES myInstance' just being updated.

Monty
 
You can also learn from the typical software updates flash or browser or Java do. Some download an update while running, some have an extra update checker, eg Java. typically the inform of an update, when it arrived, if it's an extra process anyway. Or at startup a message appears, if a new download is found in a predefined folder. Chroma manages even to update while running (at least it seems so), of course the OS dows not allow overwriting an in use file, not only an EXE.

Anyway, there are many methods. I'm sure you'll manage to arrive where you want to be.

Bye, Olaf.
 
Since I typically have the most recent version of an application on the server and the user executable on the individual workstations, I use an Application Launcher to check for the latest version and, if newer version found, download it to the workstation prior to Launch.

For my Application Launcher I generally use a variation of:
An Application starter (with auto copy from server into local station).
faq184-4492


Obviously if the latest version should be on the Net somewhere, this Launcher could be modified to check there instead of the server.

By doing things that way the user is always guaranteed to be using the latest application version regardless of how many instances they launch.
The only time this approach might fail would be if the application version were to be updated AFTER a user already had one instance up and running.

Good Luck,
JRB-Bldr




 
Like JRB, I use an application launcher that has the ability to check for updates. And it's designed so that it works just as well, regardless of how many instances of the application are running. I don't like the idea of preventing the user running multiple instances merely for the convenience of the launcher.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top