Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for instance of Word already running
Message
De
10/04/2002 06:48:03
 
 
À
09/04/2002 15:44:19
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00642865
Message ID:
00643079
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Hi Andrew,

What I do to use/instantiate an existing/new copy of MS Word is:
 If IsAppRunning         ( "OpusApp")            &&  Checks if MS-Word already running
    oWord = GetObject    (,"Word.Application")   &&  Conects to the running instance
 else
    oWord = CreateObject ( "Word.Application")   &&  Fires a new instance 
 endif
Below is the code for IsAppRunning ():
 Function IsAppRunning     
*-------- ------------
 LParameters pAppClassName

 Private cClassName, cNullPointer, nRetCode

 nRetCode      = 0
 cNullPointer  = .Null.
 cAppClassName = pAppClassName

 Declare Integer FindWindow In Win32API As CheckForWindow ;
         String  @cAppClassName, ;
         String  @nNullPointer

 nRetCode = CheckForWindow (@cAppClassName, @cNullPointer)

 Release cClassName, cNullPointer

 Return IIf (nRetCode = 0, .F., .T.)

 EndFunc     

*============================================================================
Hope it helps,

Fernando
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform