 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Peter Batten Guest
|
Posted: Thu Jul 06, 2006 3:42 am Post subject: Incorrect Function - MSOutlook 2003 |
|
|
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
|
Posted: Thu Jul 06, 2006 10:07 pm Post subject: Re: Incorrect Function - MSOutlook 2003 |
|
|
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
|
Posted: Sat Jul 08, 2006 4:30 am Post subject: Re: Incorrect Function - MSOutlook 2003 |
|
|
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
|
Posted: Sat Jul 08, 2006 11:18 pm Post subject: Re: Incorrect Function - MSOutlook 2003 |
|
|
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
|
Posted: Sun Jul 09, 2006 3:52 am Post subject: Re: Incorrect Function - MSOutlook 2003 |
|
|
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 |
|
 |
|
|
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
|
|