Search the web
Sign In
New User? Sign Up
codesnips · Code Snippets
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Single Instance apps   Message List  
Reply | Forward Message #44 of 48 |
Re: [codesnips] Single Instance apps

If we are using this code in our application and multiple users are logged in using remote desktop,Individual user cant be able to run multiple instance of our application
For example if user A and User B is Logged in to single machine
user A and B can both use application but User A and User B cant run multiple copies of the application
regards
 
Owais Anwer
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"

www.csquareonline.com
Mobile +92 0333 2223203
Office +92 21 455 2414
Fax
+92 21 454 8226
The information in this Internet email is confidential and may be legally privileged. It is intended solely for the use of the addressee. Access to this Internet email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice contained in this Internet email will be subject to the terms and conditions expressed in any applicable laws governing Creative Chaos (pvt) Limited's terms of business.

The views expressed in this email are those of the sender only. Creative Chaos (pvt) Limited will be not responsible for, and will not be held liable for, the contents of this email or any attachments thereto.
 
----- Original Message -----
Sent: Monday, July 21, 2003 11:26 PM
Subject: RE: [codesnips] Single Instance apps

and I think that asim is talking about sessions, not processes. They both are altogether different things. The operating system also maintain a separate session for each logged-in user. In the case of Operating system sessions, (in my opinion) they are not shared. "Multiuser" capability is added as a facility to the operating system and It is an enhancement over existing OS which are single user.
 
The usability of the code that fahad sent is comparable with the functionality of Microsoft MSN Messenger which restricts itself to just one instance.
 
-----Original Message-----
From: fahad [mailto:desperate_desperado@...]
Sent: Monday, July 21, 2003 2:48 PM
To: codesnips@yahoogroups.com
Subject: Re: [codesnips] Single Instance apps

i think processes are managed by OS on machine leve not the at the user level in case of a remote desktop connection ...it will work if a user, say user A is logged in and invoke the Application at some time "Ta" which is greater than "Tb" (the time when user B invokes the same Application)... then user B will get the instance of the app that was invoked by user A...
 
it would be really a chance of
Ta = Tb...
so it will wUrk.... 99.9%
 
----- Original Message -----
From: Asim
Sent: Monday, July 21, 2003 5:01 PM
Subject: RE: [codesnips] Single Instance apps

assume that 2 users are logged in, on a single machine (through remote desktop connection), and both the users try to run an instance of the app, will this code wurk ??
 
Thanks,
Asim
-----Original Message-----
From: fahad [mailto:desperate_desperado@...]
Sent: Monday, July 21, 2003 3:46 PM
To: codesnips@yahoogroups.com
Subject: [codesnips] Single Instance apps

 
hi,
 
this is my first post to this group.... its about forcing your app to have only one instance running..
 
you need to import 2 dlls to find a window and to set focus to that window

/////////
[DllImport("User32",EntryPoint="FindWindow")]
private static extern IntPtr FindWindow(string lpClassName,string lpWindowName);

[DllImport("User32",EntryPoint="SetForegroundWindow")]
private static extern bool SetForegroundWindow(IntPtr hWnd);


[STAThread]
static void Main()
{
Process ThisProcess = Process.GetCurrentProcess();
Process [] AllProcesses = Process.GetProcessesByName(ThisProcess.ProcessName);                              

if (AllProcesses.Length > 1) // if the process is running
{
bool ret;          
IntPtr hWnd = FindWindow(null, "Form1");   //the caption of your window                 
if(hWnd != IntPtr.Zero)
    {
    ret = SetForegroundWindow(hWnd);  // give focus to this window
                //you can also use BringWindowToTop instead of this
     }                    
}

else
    {//run the new process

    Application.Run(new Form1());          
    }
}


To unsubscribe from this group, send an email to:
codesnips-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


To unsubscribe from this group, send an email to:
codesnips-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


To unsubscribe from this group, send an email to:
codesnips-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


To unsubscribe from this group, send an email to:
codesnips-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Tue Jul 22, 2003 10:28 am

owais@...
Send Email Send Email

Forward
Message #44 of 48 |
Expand Messages Author Sort by Date

hi, this is my first post to this group.... its about forcing your app to have only one instance running.. you need to import 2 dlls to find a window and to...
fahad
desperate_de...
Offline Send Email
Jul 21, 2003
10:41 am

assume that 2 users are logged in, on a single machine (through remote desktop connection), and both the users try to run an instance of the app, will this...
Asim
asimletters
Offline Send Email
Jul 21, 2003
11:58 am

Messagei think processes are managed by OS on machine leve not the at the user level in case of a remote desktop connection ...it will work if a user, say user...
fahad
desperate_de...
Offline Send Email
Jul 21, 2003
1:42 pm

and I think that asim is talking about sessions, not processes. They both are altogether different things. The operating system also maintain a separate...
Nauman Leghari
laghari78
Offline Send Email
Jul 21, 2003
6:26 pm

and I think that asim is talking about sessions, not processes. They both are altogether different things. The operating system also maintain a separate...
Nauman Leghari
laghari78
Offline Send Email
Jul 21, 2003
6:26 pm

Hmmm. But still windows messenger that comes with XP, allows multiple users to use it at the same time (it may use the same thread I donno abt that.) It shows...
Faraz Beg
baigsaab22
Offline Send Email
Jul 22, 2003
6:12 am

I dont think so. You can run MSN messenger with Windows XP Messenger but you can't run two different instances for each application. They both are implemented...
Nauman Leghari
laghari78
Offline Send Email
Jul 22, 2003
4:00 pm

What I'm talking abt is the scenario in which multiple users (say a couple of them) log into an XP workstation and all have msn logged in. although there's...
Faraz Beg
baigsaab22
Offline Send Email
Jul 22, 2003
9:10 pm

MessageIf we are using this code in our application and multiple users are logged in using remote desktop,Individual user cant be able to run multiple instance...
Owais Anwer
owais@...
Send Email
Jul 22, 2003
10:23 am

Messagefriends, i didnt CHECKED that code on the case(s) you guys specified... and i dont have resources to check this as well... if you have resources, you...
fahad
desperate_de...
Offline Send Email
Jul 23, 2003
6:19 am

MessageThe scenario you are talking about is base on different sessions. When a user log into a XP workstation it's session is created ,Means each user has...
Owais Anwer
owais@...
Send Email
Jul 23, 2003
7:53 am
< Prev Topic  |  Next Topic >
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help