Page 1 of 1

Some questions about OLE

Posted: Wed Feb 21, 2007 2:07 pm
by driessen
Hello,

I use OLE to build a connection between my application and Word, Excel and Outlook. Since I have a huge agenda in my application, it is a dream from me and my customers (lawyers) to build a synchronisation between my application and Outlook because through Outlook the can synchronise with their mobile phone or their PDA. (Perhaps FiveWin for PPC is a possibility in the future).

1. Where can I find a list of the OLE-commands and -functions which can be used in FiveWin and xHarbour ?

2. Where can I find some more information about the correct syntax of these commands ?

3. Does anyone have any experience in developing a synchronisation between a FW-application and Outlook ?

4. A question about a current problem : how can I check through OLE that there is still a document opened (no matter which one) in Word ?

Thank you very much in advance.

Regards,

Michel

Posted: Wed Feb 21, 2007 2:38 pm
by Frank Demont
1. Where can I find a list of the OLE-commands and -functions which can be used in FiveWin and xHarbour ?

c:\program Files\Microsoft Office\OFFICE11\1043\VBAOL11.chm


4. A question about a current problem : how can I check through OLE that there is still a document opened (no matter which one) in Word ?

// sorry , just tested , it doesn't work
TRY
oWord := GetActiveObject( "Word.Application" )
CATCH
? "No word document"
END

Frank

Posted: Wed Feb 21, 2007 3:40 pm
by driessen
Frank,

Thanks for your answer.

But ...

1. How do I implement the OLE-commands and -functions, mentioned in VBAOL11.chm, in the FiveWin syntax ?

4. Your suggestion is not quite a solution.

In my application I have a sentence :

OleInvoke(hActiveDoc,"Close")

This sentence closes my Word-document.

But if the user has closed the Word-document manually, I got an error "No exported method: Close" in "OleInvoke(0).

I think that your suggestion only checks if the OLE to Word is still active, doesn't it ?

Thank you.

Regards,

Michel

Posted: Wed Feb 21, 2007 4:42 pm
by Frank Demont
Michel ,

If you know the filename , you can :

Code: Select all

DO WHIL .T.
    hWnd := FINDWND( cFileName ) 
    IF !EMPTY( hWnd ) 
        ? "Tijdelijke rtf-file is nog niet gesloten : " + CRLF + GETWINDOWTEXT( hWnd )
        ? "Het programma probeert dit nu zelf te doen "
        SENDMESSAGE( hWnd, 16 ) 
       //CloseWindow(hWnd) 
  ELSE
     EXIT
  END
END





// Uit http://fivetechsoft.com/forums/viewtopic.php?t=1346&start=0&postdays=0&postorder=asc&highlight=findwindow%2A
#define GW_HWNDFIRST 0 
#define GW_HWNDLAST  1 
#define GW_HWNDNEXT  2 
#define GW_HWNDPREV  3 
#define GW_OWNER     4 
#define GW_CHILD     5 

FUNCTION FINDWND( cTitle ) 

    LOCAL hWnd := GETWINDOW( GETDESKTOPWINDOW(), GW_CHILD ) 

    WHILE hWnd != 0 
        IF UPPER( cTitle ) $ UPPER( GETWINDOWTEXT( hWnd ) ) 
            RETURN hWnd 
        ENDIF 

        hWnd = GETWINDOW( hWnd, GW_HWNDNEXT ) 
    ENDDO 

    RETURN NIL 


Posted: Thu Feb 22, 2007 12:05 am
by driessen
Frank,

Thanks for your help.

I'll try it out.

Michel