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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -