473,473 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Check if VB Application is running on network

66 New Member
Hi All,

I am making a project using VB 6.0.
How can i stop multiple instances of my program being run in different systems.

I used App.PrevInst but it works only on the same system.
On any other system it is not of use
May 29 '08 #1
7 2041
CyberSoftHari
487 Recognized Expert Contributor
This will work only in local system. Can you explain why you need to check for multiple systems?
Note: multiple instances need to check only local system and there is no use of network systems multiple instances. I assume you are looking for forum authentication in network!
May 29 '08 #2
anuragshrivastava64
66 New Member
No actually we are makin an application in two modes Advanced and Standard.
In advanced version it can be used across network i.e Multi User.

But in standard version it has to be single user only.

The exe will be on server only. Other users will log on to server and use that exe
May 29 '08 #3
debasisdas
8,127 Recognized Expert Expert
better to restrict the number of con-current login to the server.
May 29 '08 #4
CyberSoftHari
487 Recognized Expert Contributor
...In advanced version it can be used across network i.e Multi User....
The word itself mean multi user (i.e) alow multiple instances for all user (in other mechines).
The exe will be on server only. Other users will log on to server and use that exe
I doubt, is there any other installation on other machines?
May 29 '08 #5
CyberSoftHari
487 Recognized Expert Contributor
better to restrict the number of con-current login to the server.
That is good, But outside that application one user can access that server machine!
May 29 '08 #6
jg007
283 Contributor
what about opening a file on a shared network when it is opened and then having you app check to see if that file is locked ( sorry not sure of code for that ) and not allowing another instance if it is
May 29 '08 #7
tristanlbailey
31 New Member
That's a good idea. I've actually been working on the code for that:

Declarations:
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  2. Public Declare Function CreateFileA Lib "kernel32" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  3. Public Declare Function DeleteFileA Lib "kernel32" (ByVal lpFileName As String) As Long
  4.  
  5. Public Const FILE_ATTRIBUTE_NORMAL As Long = 128
  6. Public Const FILE_FLAG_DELETE_ON_CLOSE = &H4000000
  7. Public Const GENERIC_READ As Long = &H80000000
  8. Public Const CREATE_NEW As Long = 1
  9.  
  10. Public hFile As Long, I As Long
  11.  
General Code: (Module)
Expand|Select|Wrap|Line Numbers
  1. Sub Main()
  2.  
  3.     hFile = CreateFileA(App.Path & "\" & "MYINST.INI", GENERIC_READ, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL Or FILE_FLAG_DELETE_ON_CLOSE, 0)
  4.     If hFile <> -1 Then
  5.         Form1.Show
  6.     Else
  7.         End
  8.     End If
  9.  
  10. End Sub
  11.  
General Code: (Form)
Expand|Select|Wrap|Line Numbers
  1. Sub Form_Unload()
  2.  
  3.     CloseHandle hFile
  4.  
  5. End Sub
  6.  
When the program runs the first time, it will create a configuration file in the same directory. The file is created with the FILE_FLAG_DELETE_ON_CLOSE value, which causes the file to be deleted when it is closed.

If another instance of the same program is created, it will see if that configuration file exists; if it does, it immediately closes. If not, it will re-create the file, and continue to run.
May 30 '08 #8

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

Similar topics

7
by: Joshua Sprague | last post by:
Recently i tested an application i was developing on another P.C. with the same harware. It was a new P.C. though and did not have the .NET framework installed on it, so i first installed...
2
by: Shawn | last post by:
Hi, I have added a spell checker to my web application using the "Microsoft Word Document" DCOM. Everything works great in my development environment. When I move everything over to my...
8
by: Pete Wittig | last post by:
Hello, I am wondering if it is possible to create a networked application with C# that is seen as a windows user. For example, if Bob logged onto windows and then started the application, any...
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
0
by: ricky | last post by:
I found the code below on how to check for a previous instance of an app, but I don't think this will work for a network executeable. So, how do you check to see if there is multiple instances of...
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...
2
by: Joris De Groote | last post by:
Hi How can I check if a directory exists in a network drive? I can check it on the local machine, but when I want to check a network drive, that doenst work, how can I do this? Thanks Joris
9
by: Michael.Suarez | last post by:
Suppose I have a program that prompts you with a dialogbox to enter a password. If you get the password correct, it allows you into the program, else it kills the program. Suppose that when I...
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...
3
by: zombiechewtoy | last post by:
I'm having a problem displaying the version number of the ClickOnce deployment on my programs, but it's under odd conditions... I have a program which is distributed via ClickOnce to around 50...
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
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,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.