MAPIInitialize

Блин скоро с ума сойду.

Есть такая ситуация:
- на компе установлен и Outlook, и Outlook Express. Причем именно Outlook Express стоит как Default mailer, т.е. именно он должен отрабатывать для запросов Simple MAPI
- гружу динамически MAPI32.DLL, получаю ссылку на MAPIInitialize и пытаюсь ее вызывать
- вполне логично ожидать, что ссылка будет пустой (т.к. Outlook Express не поддерживает Extended MAPI), но она не nil
- при попытке вызова этой функции возвращается код 0×80004005 и появляется messagebox с текстом:

“Either there is no default mail client or the current mail client cannot
fulfill the messaging request. Please run Microsoft Outlook and set it as
the default mail client.”

- пока не нажмешь OK в этом диалоге – все остановлено

Я даже готов смириться с тем, что адрес на MAPIInitialize не пустой. Но какого лешего диалог появляется? Мне он нафик не нужен и мешает.
Уже два дня не могу его заглушить…

2 Responses to “MAPIInitialize”

  1. mshkolnik says:

    Да забыл дописать – в случае, когда Outlook прописан как Default mailer, вызов MAPIInitialize отрабатывает нормально и все работает хорошо.
    Т.е. нужно именно либо убивать как-то этот диалог, либо добиваться чтобы адрус был пустой.

    Возможно что-то с флагами:
    if (@MAPIInitialize <> nil) then
    begin
    with MAPIInit do
    begin
    ulVersion := MAPI_INIT_VERSION;
    ulFlags := MAPI_NO_COINIT;
    end;
    MAPIInitRes := MAPIInitialize(@MAPIInit);
    //here we wait for prompt for some reason
    if Succeeded(MAPIInitRes) then

  2. mshkolnik says:

    *********************************************************
    Newsgroups: microsoft.public.platformsdk.mapi
    From: SGriffi…@OnLine.Mirosoft.com (“Stephen Griffin”)
    Date: Wed, 09 Jan 2002 15:31:09 GMT
    Local: Wed, Jan 9 2002 5:31 pm
    Subject: Re: Need some help with MAPIInitialize
    Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author

    Ralf,
    The error you get is from the PreFirstRun key in the registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail:PreFirstRun = “Either there is no
    default mail client or the current mail client cannot fulfill the messaging
    request. Please run Microsoft Outlook and set it as the default mail
    client.*Microsoft Outlook”

    The reason you get the error is because Outlook Express is set as your
    default client. The MAPI Stub library will therefore attempt to rout ALL
    MAPI calls to Outlook Express. However, since Outlook Express does not have
    a DllPathEx key set in the registry (because it does not implement Extended
    MAPI), the stub library cannot route the call and displays the error
    message.

    Dmitry gives two workarounds (
    >1. Set Outlook (the real one) as your default e-mail client
    >2. Link to the right dll (msmapi32.dll instead of mapi32.dll replaced by OE)
    >dynamically.
    ).

    There is a third. Create a REG_SZ key here:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MSMapiApps

    Name the key the full name of your executable (including the extension, but
    not the path). Set the value of the key to “Microsoft Outlook”.

    For example, if your app is MyApp.exe, then create the following key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging
    Subsystem\MSMapiApps:MyApp.exe = “Microsoft Outlook”

    This will cause the stub to route all MAPI calls made by your application
    to Microsoft Outlook, and not the default mail client.

    Stephen Griffin
    Microsoft Developer Support – Messaging
    *********************************************************

Leave a Reply

You must be logged in to post a comment.