473,785 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not more than one instance per user, But allow on different users

Hi there guys
I want my program not to allow more than one instance per user.
Now I have this code
CODE
Dim Processos() As Process
Processos = Process.GetProc essesByName("Ta skfind")
If Processos.Lengt h > 1 Then
NotifyIcon1.Vis ible = False
End
End If
The problem is that if Fast User Switching is enabled on XP and one user is
running my program, all the other users of that machine can't run the
program.
What can I do to ensure that no other instance of my program is running, but
only on the current user?
Thank you in advance!

Andre Nogueira
Nov 21 '05 #1
2 1892
On approach is to use a Mutex.

See: http://codeproject.com/vb/net/sing_inistan.asp

You must establish a Mutex for each user.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"André Nogueira" <an**@netcabo.p t.NOSPAM> wrote in message
news:O8******** ******@TK2MSFTN GP12.phx.gbl...
Hi there guys
I want my program not to allow more than one instance per user.
Now I have this code
CODE
Dim Processos() As Process
Processos = Process.GetProc essesByName("Ta skfind")
If Processos.Lengt h > 1 Then
NotifyIcon1.Vis ible = False
End
End If
The problem is that if Fast User Switching is enabled on XP and one user
is running my program, all the other users of that machine can't run the
program.
What can I do to ensure that no other instance of my program is running,
but only on the current user?
Thank you in advance!

Andre Nogueira

Nov 21 '05 #2
Use this function:

Private Function PrevInstance() As Boolean
If
UBound(System.D iagnostics.Proc ess.GetProcesse sByName(System. Diagnostics.Pro cess.GetCurrent Process.Process Name)) > 0 Then
Return True
Else
Return False
End If
End Function

In form load:

If PreviousExistan ce() = True Then
MessageBox.Show ("Applicatio n is already running. Press OK to exit")
End
End If

If you use 'Application.Ex it()' after showing the message box then the form
is briefly shown, but with 'End' it is halted immediately & the form is never
shown.

I hope this helps

"Mike McIntyre [MVP]" wrote:
On approach is to use a Mutex.

See: http://codeproject.com/vb/net/sing_inistan.asp

You must establish a Mutex for each user.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"André Nogueira" <an**@netcabo.p t.NOSPAM> wrote in message
news:O8******** ******@TK2MSFTN GP12.phx.gbl...
Hi there guys
I want my program not to allow more than one instance per user.
Now I have this code
CODE
Dim Processos() As Process
Processos = Process.GetProc essesByName("Ta skfind")
If Processos.Lengt h > 1 Then
NotifyIcon1.Vis ible = False
End
End If
The problem is that if Fast User Switching is enabled on XP and one user
is running my program, all the other users of that machine can't run the
program.
What can I do to ensure that no other instance of my program is running,
but only on the current user?
Thank you in advance!

Andre Nogueira


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1944
by: d.schulz81 | last post by:
Hi all, We have about 10 different domains that are linked very closely and we want to identify and track every single user that surfs our websites. Later we want to analyse user paths and find out the search robots with the referring search words. What are the possibilities? Cookies are not accepted by 40 % of our users and in addition to that for each domain a different cookie is created what makes it really
73
8073
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities as a standard portable part of the core language, the LISP package, and the java.lang package, respectively. Both have big integers, although only LISP has rationals as far as I can tell. Because CL supports keyword arguments, it has a wider range...
116
7554
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data and some who couldn't but that it wasn't important right now. And I said, 'sure, we can do that later'. So now I've developed an app without any thought to security and am trying to apply it afterwards. Doh!, doh! and triple doh!
2
1520
by: Deano | last post by:
One of the more challenging things on my app's wishlist is to make it multi-user on a LAN. For the record my app was always intended to a single-user but things have changed. It's mostly composed of bound forms handling records numbered in the hundreds, sometimes a few thousand. The code of course refers to tables in the local mdb. I allow the user to create external backups of the tables in the database and to restore them. Because...
8
2747
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 access to the network made through the application would be seen as 'C# application user' and not 'Bob'. What I want to accomplish is to create an encrypted folder on a server where files within the folder can be accessed through the application,...
8
1269
by: Balaji | last post by:
Is it possible to allow users to do more than one instance of the web application with different logins. our application uses session extensively, which meens effectively the users should get different sessions. Thanks in advance. Regards, V.Balaji
4
4531
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...
3
3014
by: netzorro | last post by:
Hi all, I have an application and each user has a different db2 login user. For db2 I have to define the users on Windows OS (2003) Is there a way to disable those windows users but allow them to login remotely to db2 ? Thanks Diego
45
3020
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class clsData Private m_objSQLClient As clsSQLClient Private m_objUsers As clsUsers
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
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
8968
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...
0
5379
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.