Please let me know if anyone has seen this condition and has an answer.
I have an applicatin that opens a word document and retrieves information to insert in a database. That is all working fine. My problem is testing for Word being open.
I have been using the Win32API for getting the handle to a file.
DECLARE INTEGER FindWindow IN Win32API;
STRING @lpClassName, ;
STRING @lpWindowName
For Word, the Class Name is "OpusApp". And the information on the Window name changes for each file I open. Since the lpWindowName must be an exact match for the function to work I will need to save the file name in order to check if Word is open using FindWindow(). Not great.
What I have found is that I can call FindWindow("OpusApp",0) and it returns a handle.
I can then open that window with another function called showwindow
DECLARE INTEGER ShowWindow IN user32 INTEGER hwnd, INTEGER nCmdShow
But it will return a handle even if Word is closed. It returns the handle Word had when it was open. This is not checking for Word being open.
I need to check for Word being open because any call to oWord.documents throws an RPC server not available error if Word is not open. Do I need to live with this and trap the error?
Has anyone seen this, or is my computer behaving funny.
TIA
Ron Seidl
Independent Developer
VFP
"I'm playing in life's theater in anticipation of a great cast party!"