Board index » delphi » OLE Messaging for MAPI vs. Delphi MAPI Interface

OLE Messaging for MAPI vs. Delphi MAPI Interface

Hello:

  If i'm using Delphi 2 - targeting only 32 bit platforms...

Why would I ever want to use the Delphi MAPI Interface (albeit
the simple MAPI interface) as opposed to using OLE Messaging?
Is their any limitations (performance, etc.) that are really going to
make any noticable differences?

For example, in one application, I want the user to be able to select
recipients out of an Address book.  I was using the simple MAPI
interface; such as MapiLogOn(...), MapiAddress(...).

I just changed it over to use OLE messaging such as the following
function fragment:

{---- begin code fragment ---}
procedure TfrmMain.btnLookupNameClick(Sender: TObject);
var
  Loop: Integer;
  V, RecipColl, RecipObj: Variant;
begin
  { Create a MAPI Session: }
  V:=CreateOleObject('MAPI.Session');

  { Logon to MAPI: }
  try
    V.Logon;
  except
    MessageDlg('Unable to Logon to MAPI; perhaps Cancelled.',
      mtError,[mbOK],0);
    Exit;
  end;

  { Open address book: }
  try
    RecipColl:=V.AddressBook(toLabel:='Pager');
  except
    MessageDlg('Unable to start or use Address Book; perhaps
Cancelled.',
      mtError,[mbOK],0);
    Exit;
  end;

  { One or more entries selected: }
  if RecipColl.Count>0 then
  begin
    for Loop:=1 to RecipColl.Count do
    begin
      RecipObj:=RecipColl.Item[Loop];
      ShowMessage('Selected ['+RecipObj.Name+']');
    end;
  end;
end;
{---- end code fragment ---}

Any info would be helpful!

------------------------------------------------------
Anything I have ever said or will ever say are my own
opinions and not necessarily those of my company.

Michael J. Loeffler
Teletrade, Inc.

mloeff...@teletrade.com
------------------------------------------------------

 

Re:OLE Messaging for MAPI vs. Delphi MAPI Interface


Michael J. Loeffler <mloeff...@teletrade.com> wrote in article
<331743fc.102115...@news.alterdial.uu.net>...

Quote
> Hello:

>   If i'm using Delphi 2 - targeting only 32 bit platforms...

> Why would I ever want to use the Delphi MAPI Interface (albeit
> the simple MAPI interface) as opposed to using OLE Messaging?
> Is their any limitations (performance, etc.) that are really going to
> make any noticable differences?

> For example, in one application, I want the user to be able to select
> recipients out of an Address book.  I was using the simple MAPI
> interface; such as MapiLogOn(...), MapiAddress(...).
[snip]

> Michael J. Loeffler
> Teletrade, Inc.

For one, OLE Messaging is not enabled in the original release of Windows
95. I don't know about SP1 or OEMSR2, which might very probably include the
missing OLE Messaging files. (These files are shipped with the Win32 SDK,
and may or may not be redistributable. Contact MS for more information)

Simple MAPI is first and foremost a compatibility layer for old MSMail32
apps. It has many limitations and will not behave very well in combination
with Exchange (W95) or Windows Messaging (NT).

Use OLE Messaging if you have the SDK or if your app runs under NT.
Otherwise, use MAPI directly.

Cheers,
-------------------------------------------------------------------------
Alexander Staubo      Professional developer, web designer, purveyor
a...@image.no         of epic thoughts and highly original ideas.

Other Threads