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 endifBelow 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,