Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find multiple runs of VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Find multiple runs of VFP
Divers
Thread ID:
00416289
Message ID:
00416289
Vues:
47
I am using the following function to see if VFP is already open. If it is I want to use set resource to another foxuser.dbf in another location. Problem is, it always thinks it is the first and trys to use the resource file already open and an error is generated.
How can I make it see that it is already open.

IF APPRUNNING("VFP 6.0",3)
COMMAND=_screen.caption = "VFP6-2"
Wait Window AT 18,35 "2nd SESSION of VFP is OPENING"
SET RESOURCE TO "E:\Program Files\Microsoft Visual Studio\Common\VFP\foxuser.dbf"
ENDIF

FUNCTION APPRUNNING (tcAppName, tnWindowSize)
*-- Parameters:
*-- 1) tcAppName:
*-- The caption in the window to check for.
*-- 2) tnWindowSize:
*-- 0 (or omitted) = Don't show the window,
*-- 1 = Show the window Normalized,
*-- 2 = Show the window Minimized,
*-- 3 = Show the window Maximize

*-- If the second parameter is not passed, then
*-- assume we don't want to show the window,
*-- we just want to know if it exists.
IF TYPE("tnWindowSize") <> "N"
tnWindowSize = 0
ENDIF

LOCAL lcNull, lnAppHandle, llReturnValue
lcNull = .NULL.
llReturnValue = .F.

*-- Define the Windows API routines.
DECLARE INTEGER FindWindow IN WIN32API ;
STRING lcNull, STRING tcAppName

DECLARE INTEGER ShowWindow IN WIN32API ;
INTEGER lnAppHandle, INTEGER tnWindowSize

*-- Get the handle of the specified window. This
*-- will return zero if no such window exists.
lnAppHandle = FindWindow(lcNull, tcAppName)

IF lnAppHandle <> 0
llReturnValue = .T.
*-- If the window size parameter is zero,
*-- then don't show the window, just report
*-- back that it is there.
*!* IF tnWindowSize > 0
*!* ShowWindow(lnAppHandle, tnWindowSize)
*!* ENDIF
ENDIF

RETURN llReturnValue
Extreme Programming = Plan -> Design -> Code -> Test
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform