Hi,
Sorry if this has been answered before, I just couldn't find it. What are the available choices for ensuring that the user cannot open two instances of my application? Which is the recommended one? Any help woulb be appreciated. Regards, Daniel |
Hi
take a look at SessionManager>> allowDuplicate allowDuplicate "It would appear that the image associated with this session is already open. Take action appropriate to the policies of the receiver. Answer whether to continue the session. The default is to carry on brazenly." ^true off course you would make your own suclass off RuntimeSessionManager and reimplement allowDuplicate Best regards Marcelo Diaz Cortez "Daniel Rozzeta" <[hidden email]> escribió en el mensaje news:[hidden email]... > Hi, > Sorry if this has been answered before, I just couldn't find it. > What are the available choices for ensuring that the user cannot open > two instances of my application? > Which is the recommended one? > > Any help woulb be appreciated. > > Regards, > Daniel |
In reply to this post by Daniel Rozzeta
Daniel
You wrote in message news:[hidden email]... > Hi, > Sorry if this has been answered before, I just couldn't find it. > What are the available choices for ensuring that the user cannot open > two instances of my application? > Which is the recommended one? Simply override #allowDuplicate in your SessionManager subclass to answer false, which will cause the second instance to exit immediately. See DevelopmentSessionManager for a slightly more sophisticated example. Regards Blair |
Hi,
Blair McGlashan wrote: > > Simply override #allowDuplicate in your SessionManager subclass to > answer false, which will cause the second instance to exit > immediately. See DevelopmentSessionManager for a slightly more > sophisticated example. FWIW: I was playing around with this recently and wanted to stop the same user from running a second instance, but allow XP fast switching between different users. According to MSDN, "Fast user switching is implemented using Terminal Services sessions.", and from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/te rmserv/kernel_object_namespaces.asp I use the following for the event name: sentryEventName | eventName | "#pathFromCSIDL is implement in the Shell packages" eventName := (ShellFolderLibrary default pathFromCSIDL: CSIDL_APPDATA) copyReplacing: $\ withObject: $/. (OSVERSIONINFO current isNT and: [OSVERSIONINFO current isNT4 not]) ifTrue: [ "This is 2k, XP or 2003 The name can have a Global\ or Local\ prefix to explicitly create the object in the global or session name space. The remainder of the name can contain any character except the backslash character (\). " eventName := 'Global\' , eventName]. ^eventName! ! Would this be a better default for applications that only write to user paths? Thanks, Steve -- Steve Waring Email: [hidden email] Journal: http://www.stevewaring.net/blog/home/index.html |
Whoops,
> (ShellFolderLibrary default pathFromCSIDL: CSIDL_APPDATA) should be: (ShellFolderLibrary default pathFromCSIDL: CSIDL_APPDATA) , self imageFileName (or something the identifies the app per user) Steve -- Steve Waring Email: [hidden email] Journal: http://www.stevewaring.net/blog/home/index.html |
In reply to this post by Blair McGlashan
Blair and Marcelo,
Thanks. It was right in front of my nose, wasn't it? Great community and product, Daniel "Blair McGlashan" <[hidden email]> wrote in message news:<bge9fi$ntit5$[hidden email]>... > Daniel > > You wrote in message news:[hidden email]... > > Hi, > > Sorry if this has been answered before, I just couldn't find it. > > What are the available choices for ensuring that the user cannot open > > two instances of my application? > > Which is the recommended one? > > Simply override #allowDuplicate in your SessionManager subclass to answer > false, which will cause the second instance to exit immediately. See > DevelopmentSessionManager for a slightly more sophisticated example. > > Regards > > Blair |
In reply to this post by Steve Alan Waring
"Steve Waring" <[hidden email]> wrote in message
news:bgell5$mtr3o$[hidden email]... > Hi, > > Blair McGlashan wrote: > > > > Simply override #allowDuplicate in your SessionManager subclass to > > answer false, which will cause the second instance to exit > > immediately. See DevelopmentSessionManager for a slightly more > > sophisticated example. > > FWIW: I was playing around with this recently and wanted to stop the same > user from running a second instance, but allow XP fast switching between > different users. > .... Steve, I must be missing something here because by default "global" (small G) kernel object names are actually session local unless specifically prefixed with "Global\" (big G). In other words the Win32 Event name that Dolphin uses (a canonicalized "image" name) will be unique within each user session for a particular application (or image), and so it should prevent the same user running a second application instance, but not prevent another user from doing so. Certainly this is demonstrably the case with the development environment, although ironically in that case it should perhaps be using a Global event name to prevent conflict over the change log and image files. Perhaps this is the sort of thing you are getting at, and in fact I'm not sure there is one policy here that would suit all applications. I'd rather stick with TSTTCPW in the base and in the next patch level we'll refactor out the generation of the sentry name so that it is easier to specialise. Regards Blair |
Hi Blair,
> Steve, I must be missing something here because by default "global" > (small G) kernel object names are actually session local unless > specifically prefixed with "Global\" (big G). Yes, you are right. However, while prefixing the name with "Global\" may not be necessary for XP fast-user switching, it may be necessary for Terminal sessions. Without being able to test this, I assume the same user could be running multiple sessions, and using the "Global\" prefix would stop the application from running in more than one of those sessions. > In other words the > Win32 Event name that Dolphin uses (a canonicalized "image" name) > will be unique within each user session for a particular application > (or image), and so it should prevent the same user running a second > application instance, but not prevent another user from doing so. OK, I see this now. This would be what that MSDN page describes as: "Note that the more common case of running the "application once per session is supported by " default since the named object is created in a "per session namespace." > and in fact I'm not sure there is one policy here that would suit all > applications. I'd rather stick with TSTTCPW in the base and in the > next patch level we'll refactor out the generation of the sentry name > so that it is easier to specialise. That would be handy, but after reading your message, I think I have made a mountain out of mole hill :) I had a user tell me that they were running my application on 2003 using terminal sessions and I came across that "Kernel Object Namespaces" MSDN page researching the implications of that. Using my sentry name would only be necessary in the case of the same user name being active in multiple sessions, and I dont know enough about terminal services to know if that is a rare or impossible case. Thanks! Steve -- Steve Waring Email: [hidden email] Journal: http://www.stevewaring.net/blog/home/index.html |
Steve and Blair,
"Steve Waring" <[hidden email]> wrote in message news:bgpb2g$r8ssu$[hidden email]... [...] Without being able to test this, I assume the same user could be > running multiple sessions [...] That is indeed possible. In Windows Server 2003, there's a checkbox for the feature; by default, users aren't restricted to a single session. I think it's also possible on 2000 and using Citrix Metaframe. Nevertheless, considering that most organizations use Terminal Server (or Citrix Systems' enhanced version) to save resources, it seems unlikely that many would allow users to log on to multiple sessions. Of course, we do with ours, but we're different--and I'm the only one who uses it ;^). Don |
Free forum by Nabble | Edit this page |