Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HProcess -- waiting for Word to complete
Message
From
08/02/2002 11:21:51
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
HProcess -- waiting for Word to complete
Miscellaneous
Thread ID:
00617439
Message ID:
00617439
Views:
61
can anyone tell me how i can get the process handle for Word when i create an instance of Word ?
i.e. i create an instance of word using this:
   obj_Word = CREATEOBJECT( "Word.Application" )
   obj_Word.VISIBLE = .T.
     ...
and the user does some typing and editing in Word.
(i've created a toolbar with two macro buttons, which amount to
-- "save stuff to clipboard and quit Word" and
-- "empty the clipboard and quit Word".

back in my VFP app, i want to be able to sit there and wait for them to quit Word, at which time i will store the clipboard contents into a memo field.

from a previous article here, i found i could start a process and wait for it to complete by doing the following (i'm using Adobe distiller in this example) :
Startup_Info = long2str(68) + REPLICATE(CHR(0), 64)
Process_Info = REPLICATE(CHR(0), 16)
Command_String = ALLTRIM(Distiller_EXE_Spec) + ' ' + ;
                 ALLTRIM(PS_PDF_Combiner_File_Spec) + CHR(0)
Return_Code = CreateProcess(0 , Command_String , 0 , 0 , 1 , NORMAL_PRIORITY_CLASS, 0, 0, @Startup_Info, @Process_Info )
IF Return_Code = 0
  =MESSAGEBOX("Error occurred. Error code: ", GetLastError())
  RETURN
ENDIF
hProcess = str2long(SUBSTR(Process_Info, 1, 4))
DO WHILE ( .T. )
  IF ( WaitForSingleObject(hProcess, WAIT_INTERVAL) != WAIT_TIMEOUT )
    EXIT
  ELSE
    DOEVENTS
  ENDIF
ENDDO
Return_Code = CloseHandle (hProcess)
i want to learn how to get the process hande when i start Word using the CREATEOBJECT technique as shown above.

any help would sure be appreciated.
patrick
Next
Reply
Map
View

Click here to load this message in the networking platform