Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for instance of Word already running
Message
From
10/04/2002 06:48:03
 
 
To
09/04/2002 15:44:19
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00642865
Message ID:
00643079
Views:
15
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform