Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook 2007 crashed when pushing send on a displayed mailitem

0 views
Skip to first unread message

Jeroen

unread,
Jun 30, 2009, 7:32:01 AM6/30/09
to
Hello,

I have the following problem:

When I display a mailitem and push send Outlook 2007 crashed with no error.
It only happens when Outlook is not started when I execute my code.

It happens on different computers. SP2 is installed.

I use the following code:

var
Outlook : OLEVariant;
MailItem : OleVariant;
MAPI : OleVariant;
Folder : OleVariant;
begin
try
Outlook:=GetActiveOleObject('Outlook.Application') ;
except
Outlook:=CreateOleObject('Outlook.Application') ;
end;

MAPI := Outlook.GetNameSpace('MAPI');
Folder := MAPI.GetDefaultFolder(olFolderOutbox);
MailItem := Folder.Items.Add(olMailItem);

begin
try
MailItem.To := 'som...@home.nl';
MailItem.Display(false);
except
end;
end; {with}

Jeroen

unread,
Jul 1, 2009, 10:06:20 AM7/1/09
to
Problem solved by starting Outlook with a ShellExecute and then ask the
handle for the COM object. Somehow starting Outlook through com causes the
exceptio mentioned earlier.
0 new messages