BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Incorrect Function - MSOutlook 2003

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Peter Batten
Guest





PostPosted: Thu Jul 06, 2006 3:42 am    Post subject: Incorrect Function - MSOutlook 2003 Reply with quote



I have a number of MSOutlook functions working perfectly on most systems.

I now have 2 user reports of an "Incorrect Function" error when connecting
to Outlook using operating system WinXP and Outlook 2003. I am guessing
that this is a subtle syntax error in the different versions. I am unable to
duplicate the error and not all machines with the same configuration report
the same error.

Any clues appreciated

TIA

Peter
Back to top
Dmitry Streblechenko
Guest





PostPosted: Thu Jul 06, 2006 10:07 pm    Post subject: Re: Incorrect Function - MSOutlook 2003 Reply with quote



Which lines of code exactly cause those errors?
The latest SPs of Outlook tend to return non-critical (>0) errors from
several methods (most notably MailItem.Display). Such errors can be safely
ignored, but Delphi gets all freaked out because it only tests for S_OK (=0)
instead of SUCCEEDED (>0).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44ac4063$1 (AT) newsgroups (DOT) borland.com...
Quote:
I have a number of MSOutlook functions working perfectly on most systems.

I now have 2 user reports of an "Incorrect Function" error when connecting
to Outlook using operating system WinXP and Outlook 2003. I am guessing
that this is a subtle syntax error in the different versions. I am unable
to
duplicate the error and not all machines with the same configuration
report
the same error.

Any clues appreciated

TIA

Peter

Back to top
Peter Batten
Guest





PostPosted: Sat Jul 08, 2006 4:30 am    Post subject: Re: Incorrect Function - MSOutlook 2003 Reply with quote



So Dmitry,

Are you suggesting that placing an error handler around the display method
should resolve this?

I am not quite sure I understand the difference between S_OK and SUCCEEDED
as I don't see a return value for Display

"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> wrote in message
news:44ad4298$1 (AT) newsgroups (DOT) borland.com...
Quote:
Which lines of code exactly cause those errors?
The latest SPs of Outlook tend to return non-critical (>0) errors from
several methods (most notably MailItem.Display). Such errors can be safely
ignored, but Delphi gets all freaked out because it only tests for S_OK
(=0)
instead of SUCCEEDED (>0).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44ac4063$1 (AT) newsgroups (DOT) borland.com...
I have a number of MSOutlook functions working perfectly on most systems.

I now have 2 user reports of an "Incorrect Function" error when
connecting
to Outlook using operating system WinXP and Outlook 2003. I am guessing
that this is a subtle syntax error in the different versions. I am
unable
to
duplicate the error and not all machines with the same configuration
report
the same error.

Any clues appreciated

TIA

Peter



Back to top
Dmitry Streblechenko
Guest





PostPosted: Sat Jul 08, 2006 11:18 pm    Post subject: Re: Incorrect Function - MSOutlook 2003 Reply with quote

Yes, a try...except block would do.
All COM automation methods return an integer result code (HRESULT), it is
just Delphi (and VB) hides that by making what is known in Delphi as
safecall calling convention: on the low level, a function is called, the
last [out] parameter is treated as the function result, and the compiler
checks the real function return result. Delphi raises an error it is
anything but S_OK (0), but VB checks if it is > 0 (that's what SUCCEEDED
macro/function does).
You can turn off safecall mapping before importing a type library ("Tool |
Environment Optiond | Typer Library | SafeCall Funcction Mapping"), then
import the Outlook type library - all method will return HResult with an
extra [out] parameter.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44aeeed6 (AT) newsgroups (DOT) borland.com...
Quote:
So Dmitry,

Are you suggesting that placing an error handler around the display method
should resolve this?

I am not quite sure I understand the difference between S_OK and SUCCEEDED
as I don't see a return value for Display

"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> wrote in message
news:44ad4298$1 (AT) newsgroups (DOT) borland.com...
Which lines of code exactly cause those errors?
The latest SPs of Outlook tend to return non-critical (>0) errors from
several methods (most notably MailItem.Display). Such errors can be
safely
ignored, but Delphi gets all freaked out because it only tests for S_OK
(=0)
instead of SUCCEEDED (>0).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44ac4063$1 (AT) newsgroups (DOT) borland.com...
I have a number of MSOutlook functions working perfectly on most
systems.

I now have 2 user reports of an "Incorrect Function" error when
connecting
to Outlook using operating system WinXP and Outlook 2003. I am
guessing
that this is a subtle syntax error in the different versions. I am
unable
to
duplicate the error and not all machines with the same configuration
report
the same error.

Any clues appreciated

TIA

Peter





Back to top
Peter Batten
Guest





PostPosted: Sun Jul 09, 2006 3:52 am    Post subject: Re: Incorrect Function - MSOutlook 2003 Reply with quote

Thanks Dmitry,

I wish this knowledge was better published in the Delphi Help.

Anyway, the exception handler has been incorporated so I will get the users
experiencing the problem to test it and see how we go.

Regards

Peter

"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> wrote in message
news:44aff65b$1 (AT) newsgroups (DOT) borland.com...
Quote:
Yes, a try...except block would do.
All COM automation methods return an integer result code (HRESULT), it is
just Delphi (and VB) hides that by making what is known in Delphi as
safecall calling convention: on the low level, a function is called, the
last [out] parameter is treated as the function result, and the compiler
checks the real function return result. Delphi raises an error it is
anything but S_OK (0), but VB checks if it is > 0 (that's what SUCCEEDED
macro/function does).
You can turn off safecall mapping before importing a type library ("Tool |
Environment Optiond | Typer Library | SafeCall Funcction Mapping"), then
import the Outlook type library - all method will return HResult with an
extra [out] parameter.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44aeeed6 (AT) newsgroups (DOT) borland.com...
So Dmitry,

Are you suggesting that placing an error handler around the display
method
should resolve this?

I am not quite sure I understand the difference between S_OK and
SUCCEEDED
as I don't see a return value for Display

"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> wrote in message
news:44ad4298$1 (AT) newsgroups (DOT) borland.com...
Which lines of code exactly cause those errors?
The latest SPs of Outlook tend to return non-critical (>0) errors from
several methods (most notably MailItem.Display). Such errors can be
safely
ignored, but Delphi gets all freaked out because it only tests for S_OK
(=0)
instead of SUCCEEDED (>0).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Peter Batten" <datafast (AT) tpgi (DOT) com.au> wrote in message
news:44ac4063$1 (AT) newsgroups (DOT) borland.com...
I have a number of MSOutlook functions working perfectly on most
systems.

I now have 2 user reports of an "Incorrect Function" error when
connecting
to Outlook using operating system WinXP and Outlook 2003. I am
guessing
that this is a subtle syntax error in the different versions. I am
unable
to
duplicate the error and not all machines with the same configuration
report
the same error.

Any clues appreciated

TIA

Peter







Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.