Re: Ole with indy

Giganews Newsgroups
Subject: Re: Ole with indy
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Tue, 28 Feb 2006

"Carlomagno Antonello" <a.carlomag…@synergica.it> wrote in message
news:4E7C7A2A06EFE240a.carlomag…@synergica.it...

> I write this very simple code but I get an error on the first line:

You did not say what the actual error is.  However, I would guess that you
need to initialize the COM library for the thread via the CoInitialize()
function, ie:

    procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TBytes;
ABinding: TIdSocketHandle);
    var
        O,N,C : Variant;
    begin
        CoInitialize(nil);
        try
            O := CreateOleObject('Outlook.Application');
            N := O.GetNamespace('MAPI');
            C := N.GetDefaultFolder(10);
        finally
            CoUninitialize;
        end;
    end;

Gambit

Replies

In response to

Ole with indy posted by Carlomagno Antonello on Tue, 28 Feb 2006