Board index » delphi » MAPI unit not working with Win'98

MAPI unit not working with Win'98

Hi,

Has anyone had trouble with the MAPI wrapper supplied with Delphi 4 Pro on
Windows 98?

I have tried lots of source code gatherd from across the internet (for using
the MAPI unit supplied with Delphi) but still can't get MAPI working via
Delphi 4 Pro on my Windows 98 machine.

Even the demo which comes with Delphi doesn't work. Ie when I go File, New,
and Select the Projects tab then click on "Win95 Logo Application" the
resultant program has an email button on the toolbar which uses MAPI but
when ever I press the button I get an error message.

The particular error message is generated because the result code of the
MapiSendMail function indicates an error.

Looking in the Win32 API help file I have been able to figure out that the
error value returned is MAPI_E_USER_ABORT which has the value of 1 (as
defined in MAPI.PAS). According to the Win32 help file this means "The user
canceled the process; no message was sent".

Since I havn't closed / seen any windows or even done a thing I am curious
why it is returning this value. Looking at the source code to the MAPI unit
the only other reason the value of 1 would be returned by MapiSendMail
function was if the MAPI DLL (MAPI32.DLL) and or the MAPI DLL function
MAPISendMail could not be found / linked to dynamically.

Searching my harddrive of course MAPI32.DLL was found in C:\Windows\System\
(where it should usually be) so the only reason I can seem to find for the
MAPISendMail function to fail if it actually fails internally but why would
it fail?

This is the example code given by the "Win95 Logo Application" as comes with
the Default install of Delphi 4 Pro:

var MapiMessage: TMapiMessage;
MError: Cardinal;

begin
  with MapiMessage do
  begin
      ulReserved := 0;
      lpszSubject := nil;
      lpszNoteText := PChar(Editor.Lines.Text);
      lpszMessageType := nil;
      lpszDateReceived := nil;
      lpszConversationID := nil;
      flFlags := 0;
      lpOriginator := nil;
      nRecipCount := 0;
      lpRecips := nil;
      nFileCount := 0;
      lpFiles := nil;
  end;

MError := MapiSendMail(0, 0, MapiMessage,MAPI_DIALOG or MAPI_LOGON_UI or
MAPI_NEW_SESSION, 0);

As you can see it is not that complicated and it should work by the looks of
it, but it fails on my setup of Win'98 and Delphi 4 Pro.

Any ideas?

Thanks,
Christopher Fairbairn.

 

Re:MAPI unit not working with Win'98


: "Christopher Fairbairn" <lgc...@es.co.nz> wrote:

Quote
>Has anyone had trouble with the MAPI wrapper supplied with Delphi 4 Pro on
>Windows 98?

Install MAPI support from the Win98 CD. Don't forget to say thank you to
Microsoft for being so terribly kind to you.

--
Stefan Hoffmeister    (http://www.econos.de/)
No private email, please, unless expressly invited.

Other Threads