PrepareForm access violation

D

Denis

Hello.

We found that PrepareForm generates access violation in Office 2003 SP3.
It will generate access violation if you try to call it from external
process. In our case we have to call PrepareForm from uninstallation. It
requires to republish custom forms.
Everything worked properly till Office 2003 SP3 was released.
Please, see code below that generates access violation if you execute it
from external process(test application in our case).
The same code works properly if you run from COM Add-in.

void external_publish_access_violation()
{
MAPIInitialize(NULL);


Outlook::_ApplicationPtr ol_app =
Outlook::_ApplicationPtr(L"Outlook.Application");
Outlook::MAPIFolderPtr type_root =
ol_app->Session->GetDefaultFolder(Outlook::blush:lFolderTasks);
_variant_t fd_v;
Outlook::FormDescriptionPtr fd;
Outlook::_TaskItemPtr task =
ol_app->CreateItem(Outlook::blush:lTaskItem);
fd = task->FormDescription;
_variant_t vt = fd->Name;
fd->Name = str2bstr(L"new_task_item");
fd->PublishForm(Outlook::blush:lPersonalRegistry);

IMAPIFormMgrPtr form_manager;
IMAPIFormInfoPtr fi;

::MAPIOpenFormMgr((IMAPISessionPtr)ol_app->Session->MAPIOBJECT,
&form_manager);

// message class is resolved succesfully
HRESULT hr=
form_manager->ResolveMessageClass("IPM.Task.new_task_item",
MAPIFORM_EXACTMATCH, 0, &fi);

// ACCESS VIOLATION
hr = form_manager->PrepareForm(0, 0, fi);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top