Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Citrix and VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Divers
Thread ID:
00393411
Message ID:
00412125
Vues:
14
>Is there a way to tell if a VFP application was started inside a Citrix Terminal Session?

Sorry about the lateness of the reply, but I just had this come up, and have a relatively easy solution, at least under MetaFrame. Since VFP6 doesn't really work correctly without NT 4.0 or later, for me it isn't a problem. If you run under the older version of Citrix that relies on 3.51, son, yer on yer own...

The Windows Event synchronization object can be created in the Terminal Server environment in the Session context; this would allow you to create an event in the Session scope and use that to determine if the application is already running; something like:
DECLARE INTEGER CreateEvent IN WIN32API ;
   INTEGER lpEventAttributes, ;
   SHORT bManualReset, ;
   SHORT bInitialState, ;
   STRING @ lpName
DECLARE INTEGER GetLastError IN Win32API
DECLARE CloseHandle IN Win32API INTEGER hObject
*  Prepend with either 'Session/' or 'Local/' to limit the event scope
*  to the present Terminal Server session context.  See CreateEvent() in
*  the MSDN to get full details on the exact meaning of the Local and 
*  Session scope.  The scope is ignored except under Terminal Server.
nEh = CreateEvent(0,0,1, 'Session/' + PROGRAM(0) + '.EVENT')
IF GetLastError() = 183 OR nEh = 0
   *  There's an instance running already (183) or the Event can't be defined
   *  So don't do it;  do release the handle, since it's harmless and should
   *  be done rather than relying on Windows to clean up after itself
   =CloseHandle(nEh)
   QUIT
ENDIF
This has not been tested under Citrix under WinNT 3.51; it is applicable to NT 4.0 and Win2K Terminal Server with MetaFrame. The Event is supported under NT 3.51, but I don't know about Citrix's support for scoping the event.

Terminating the process, or closing the Event handle will make it go away. Don't issue a CLEAR ALL if the app is going to continue running. CLOSE ALL will close open Handles, including Events and Low-level files.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform