FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Outlook
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Outlook
Posted: Wed Jan 28, 2009 03:32 PM

Hello Michael,
would you be so kind to post your code how you test if outlook is running and if not how you start Outlook.
Thanks in advance
Otto

>Which version of Outlook are you using ?

>I had a similar problem with Outlook 2007 but not with previous versions.

>The GPF disappeared after I added a test which checks if Outlook2007 has already been opened and if not, Outlook 2007 is >opened by using WinExec() before the CreateObject().

>Might this also be your problem ?

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Outlook
Posted: Wed Jan 28, 2009 05:01 PM
Otto,

Here is the code you asked for :
IF !EMPTY(US->UOUTPATH) .AND. FILE(ALLTRIM(US->UOUTPATH))
    cTasks := GetTasks()
    FOR i=1 TO LEN(cTasks)
        IF AT("OUTLOOK",UPPER(cTasks[i])) <> 0
            OutlFound := .T.
            i := LEN(cTasks)
        ENDIF
    NEXT
    IF !OutlFound ; WINEXEC(US->UOUTPATH,2) ; ENDIF
ENDIF

TRY
    oOutLook   := CreateObject("Outlook.Application")
    oNameSpace := oOutlook:GetNameSpace("MAPI")
    EmSend     := .T.
CATCH
    TRY
        oOutLook   := CreateObject("Outlook.Application")
        oNameSpace := oOutlook:GetNameSpace("MAPI")
        EmSend     := .T.
    CATCH
        EmSend   := .F.
    END
END

IF EmSend


... and then the rest of the code.

This is working very well.

US->UOUTPATH holds the complete pathname of the OUTLOOK.EXE. Especially for Outlook 2007, it is necessary that Outlook is started before an email is send.

Good luck.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Outlook
Posted: Wed Jan 28, 2009 05:25 PM

Thank you, Michael.
>US->UOUTPATH holds the complete pathname of the OUTLOOK.EXE.

This was my problem. I tried with winexec(“outlook.exe”) but this does not work.
How do you find the outlook path.

Thanks in advance
Otto

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Outlook
Posted: Thu Jan 29, 2009 10:11 AM
Otto,

I have a dialogbox with parameters. One of them is the pathname of OUTLOOK.EXE which I search by using this function (which can be activated by pushing a button) :
FUNCTION SearchFile(FileZk,ArgZk,ZkRet)

   LOCAL ZkFile   := ""
   LOCAL ZkLen    := 0

   PRIVATE SpFile := ""
   PRIVATE SpPath := ""

   DEFAULT(ZkRet,.F.)

   IF ZkRet ; ZkLen := LEN(FileZk) ; ENDIF

   SplitsPath(FileZk)

   ZkFile := LFN2SFN(ALLTRIM(CGETFILE(IF(EMPTY(FileZk),ALLTRIM(ArgZk),ALLTRIM(SpFile)),"Make your choice",,IF(EMPTY(FileZk),"C:\",ALLTRIM(SpPath)))))

   IF EMPTY(ZkFile) ; ZkFile := FileZk ; ENDIF

   IF ZkRet .AND. ZkLen <> 0 ; ZkFile := LEFT(ALLTRIM(ZkFile) + SPACE(ZkLen),ZkLen) ; ENDIF

RETURN(ZkFile)


Good luck.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Outlook
Posted: Thu Jan 29, 2009 02:17 PM

Hello Michel,

If I am right CGETFILE opens a dialog.
I thought of an automatism.
I found you can get the WINWORD path like that:

oWord := CREATEOBJECT( "Word.Application" )
cWordPath : =oword:path + "\WINWORD.EXE"

and hoped there is a path method also in the outlook-object.
Till now I didn’t found.
Maybe one could use the registry key?

What do you think?

Regards,
Otto

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Outlook
Posted: Fri Jan 30, 2009 08:39 AM

Otto,

I'm afraid I can't help you.

Indeed, there is no path method for Outlook.

But can you tell me where I can find al the methods which are possible for Word and Outlook ?

I am looking for more information because I want to build a synchronisation between my application and Outlook. Until now, the information I got was very little.

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Outlook
Posted: Fri Jan 30, 2009 08:52 AM

Search for vba*.chm in your hard disk or in the Office CD or consult the MSDN.

EMG

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Outlook
Posted: Thu Feb 05, 2009 12:42 AM
Hello Michel,
today I found this code in the FIVEWIN samples:
testreg3.prg
This code returns the Outlook path.
Regards,
Otto

#define  HKEY_LOCAL_MACHINE      2147483650

FUNCTION GetOutlookPath()
 Local oReg, cOLPath

 oReg := TReg32():New( HKEY_LOCAL_MACHINE, ;
    "Software\Microsoft\Windows\CurrentVersion\App Paths\Outlook.exe", .f. )
 cOLPath := oReg:Get( Nil, "" )                // i.e. (Default) key
 oReg:close()

 MsgInfo( sfn2lfn(cOLPath ))

RETURN nil

Continue the discussion