Dan, Thank you.
The sample is helpful. ^^
Now, I know which MAPI Properties are corresponding and availble to use.
um... actually I am not sure which method I am using now. (EDK or Extended
MAPI or whatever.) So I am not sure whether it will get risk easily.
However, I should hand on something by tmr.
Therefore, even I found the source of earlier version of MFCMAPI.exe. I
still don't have time to go through all now. :( (hope I will have time to
learn it)
Because of the time limit, I got two questions now. after running the
MFCMAPI and the sample from MSDN.
http://support.microsoft.com/Default.aspx?kbid=304894
(Now I am modifying the MSDN to get the information I want because it is
much shorter and easiler for me to mantain it by my limited understanding of
MAPI or outlook programming)
Q1. When I used both samples, MFCMAPI or the code from msdn, there is a
dialog box popup and asked user to press ok for "logon" to outlook.
- I tried set the "flag" of MAPILogonEx to 0 in MSDN sample, then the popup
dialog does not popup. However, I have to set the Outlook as default browser.
If not, it will fail in calling MAPIInitialize(), and popup a message "Enter
there is o default mal client or the current mail client cannot fulfill the
messaging requrest. Please run Microsoft Outlook and set it as the default
mail client".
- I also tried to set the same (flag = 0)on MFCMAPI, but it gets error when
calling MAPILogonEx (). I think the sample may assume some flags must on.
such as MAPI_LOGON_UI
- However, when I did the research, I found a software called UltraRecall.
It can get the info of outlook items (autor, received date, shortcut link --
these fileds are what I want in my current task). When using it, I don't have
to set Outlook as default email viewer and No MessageBox popup waiting me
press enter.
Therefore, I guess a solution should be there. But I don't know is it from
Extended MAPI or where. Does any have idea? thanks...
Q2. From MSDN, MAPIInitialize() can't be called within DllMain function or
any other function that creates or terminates threads. I wonder if I make a
function call where I do the initialization, extraction and uninitialization,
could it be run?
This is my second task. (have to done by tmr. :(, maybe I will know it soon
if I can do the first task)
Thank you first.
PS. "Exchange SDK" <-- I viewed too much pages about outlook programming in
this short period, so I mixed the Exchange server and EDK (is that call
Emebbed Development Kit!?). Actually I want to mention the SDK including
edk.h and its libraries. (it should be called EDK, right? :P
lastly, sorry for my poor english.
> Therefore, even I found the source of earlier version of MFCMAPI.exe.
> I still don't have time to go through all now. :( (hope I will have
> time to learn it)
You will have a _much_ easier time if you try and work out how to do
this stuff yourself. Extended MAPI is not a simple API, but it all does
make sense once you understand it.
> Q1. When I used both samples, MFCMAPI or the code from msdn, there is
> a dialog box popup and asked user to press ok for "logon" to outlook.
[quoted text clipped - 4 lines]
> mail client cannot fulfill the messaging requrest. Please run
> Microsoft Outlook and set it as the default mail client".
Which mail client are you trying to use otherwise? Outlook is the only
mail client that supports Extended MAPI -- you can't use ExMAPI code
with Outlook Express or Thunderbird or Eudora, etc. (Notes has some
support but it's flaky, Groupwise's support is apparently even worse)
> Q2. From MSDN, MAPIInitialize() can't be called within DllMain
> function or any other function that creates or terminates threads. I
> wonder if I make a function call where I do the initialization,
> extraction and uninitialization, could it be run?
> This is my second task. (have to done by tmr. :(, maybe I will know it
> soon if I can do the first task)
I think this will depend on exactly what you're doing -- MAPI is
thread-safe, but the usual threaded app restrictions apply. See this
thread, for example:
http://peach.ease.lsoft.com/scripts/wa.exe?A2=ind9610&L=MAPI-L&P=R12499
and there's a bunch of other discussion of threading in the archives of
mapi-l there -- watch for initializing COM (or MAPI) the correct number
of times. See the documentation (the 'using thread-safe objects' link
from the page you presumably found which mentions DllMain)-- you just
have to call MAPIInitialize once on each thread, and check the
'implementing thread-safe objects' page in the 'threading in MAPI'
section in MSDN for a bit more.
> PS. "Exchange SDK" <-- I viewed too much pages about outlook
> programming in this short period, so I mixed the Exchange server and
> EDK (is that call Emebbed Development Kit!?). Actually I want to
> mention the SDK including edk.h and its libraries. (it should be
> called EDK, right? :P
Read the link on Jason Johnston's blog I posted for more about what's
in edk.h. It's just a bunch of helper functions to make ExMAPI coding
easier, but there are bugs in it and edk.lib is very hard to get to link
properly. You don't need to use it directly to talk to Outlook, I just
got the source and used it as sample code to help build my apps.
-- dan
ew - 22 Nov 2006 02:11 GMT
Dan, Thank you very much again. ^^
> Which mail client are you trying to use otherwise? Outlook is the only
> mail client that supports Extended MAPI -- you can't use ExMAPI code
> with Outlook Express or Thunderbird or Eudora, etc. (Notes has some
> support but it's flaky, Groupwise's support is apparently even worse)
um... How's about I use outlook express as default mail client?
anyway If I use Outlook Express as default, the MAPIInitialize() has already
failed to call and pops up a warning message to ask user set Outlook as
default one.
The MAPIInitialize() don't have any parameter to off the message. If so,
will there have any method detecting whether Outlook is the default email
client?
For the MAPILogonEx() problem, I have set the flag of MAPILogonEx() to 0.
ie. MAPI_LOGON_UI is removed. So that the popup dialog, which asked user
confirming connecting to Outlook, is disappeared now. ^^
Dan Mitchell - 22 Nov 2006 16:59 GMT
> um... How's about I use outlook express as default mail client?
If you're using OE as a default client, then you will have to use
Simple MAPI, not Extended MAPI, and then you'll be calling MAPILogon,
not MAPIInitialize, and those problems will go away.
>anyway If I use Outlook Express as default, the MAPIInitialize() has
>already failed to call and pops up a warning message to ask user
>set Outlook as default one.
That's because MAPIInitialize won't talk to OE, it'll talk to Outlook,
because OE doesn't support that API. Then Outlook comes up and says
"hey, I'm not the default mail client", and thus the dialog.
>will there have any method detecting whether Outlook is the
>default email client?
Look in the registry here:
HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\(default).
You may also find more generally useful info here:
http://groups.google.com/groups/search?q=default+mail+client
-- dan