visual c++ - How to start Outlook from unmanaged VC++ Code? -
long story: i've managed quite few tasks extended mapi libary http://www.codeproject.com/articles/10881/mapiex-extended-mapi-wrapper. problem is, not send actual messages if outlook not running, stores messages in outbox though, , send them libary function require login profile i'll not alwas have.
short story: need start installed outlook (did check) default profault profile can send messages in it's outbox, if any.
there mice , slick solutions in c#, 2 6 lines of code unfortunately have stick unmanaged vc++.
first try: i've done quite few things win32 ole interface , microsoft word. time want program start, if not running. tried
// outlook test coinitialize(null); clsid clsid; hresult hr = clsidfromprogid(l"outlook.application", &clsid); idispatch *poapp; if(succeeded(hr)) { iunknown *punk; hr = getactiveobject(clsid, null, (iunknown**)&punk); if(failed(hr)) { hr = cocreateinstance(clsid, null, clsctx_local_server, iid_idispatch, (void **)&poapp); if(failed(hr)) poapp=null; } else if(punk) { hr = punk->queryinterface(iid_idispatch, (void **)&poapp); if(failed(hr)) poapp=null; } }
but still missing.
i appreciate can provide
you may consider using raw extended mapi code in unmanaged c++ without automating outlook. moreover, in case of using outlook object model security prompt send method triggers. can read in outlook "object model guard" security issues developers article.
see how create message attachment , send using mapi/vc++ sample in c++ (extended mapi).
Comments
Post a Comment