Outlook

Outlook

Postby Otto » Wed Jan 28, 2009 3: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 ?
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Outlook

Postby driessen » Wed Jan 28, 2009 5:01 pm

Otto,

Here is the code you asked for :
Code: Select all  Expand view
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Outlook

Postby Otto » Wed Jan 28, 2009 5: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Outlook

Postby driessen » 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) :
Code: Select all  Expand view
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Outlook

Postby Otto » Thu Jan 29, 2009 2: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Outlook

Postby driessen » Fri Jan 30, 2009 8: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Outlook

Postby Enrico Maria Giordano » Fri Jan 30, 2009 8:52 am

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Outlook

Postby Otto » 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

Code: Select all  Expand view
#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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests