Custom form

G

Guest

I made a custom form and published it following these steps,

1. Open a new mail message. On the Tools menu, click Forms and then click
Design This Form.
2. Click the (P.2) page of the form. On the Form menu, click Control
Toolbox. Use the Control Toolbox to add a Command Button to page P.2.
3. On the Tools menu, click Forms and then click Publish Form As. Select the
Inbox as the destination, enter MyForm as the Display Name, and then click
Publish. Choose either Yes or No when you are prompted about sending the form
definition with the item.
4. Close and don't save changes to the form.
5. On the Actions menu, click New MyForm.
6. Click the P.2 page of the form and click the button.

I verified this by clicking the Actions menu and saw New MyForm listed at
the bottom of the menu.

I am doing in vc++ 6.0 and using the Com dll.i wnat to show my custom form
instead of the default form which i want to do in the Inspector event since i
have to do thsi for some particular messages only.

// -------------showing the custom form---------------
_bstr_t bstrName_T (_T("MAPI"));
BSTR bstrName;
bstrName = bstrName_T.copy();
CComPtr <Outlook::_NameSpace> olNs;
m_spApp->GetNamespace(bstrName,&olNs);
CComQIPtr <Outlook::MAPIFolder> oInbox;
Outlook::OlDefaultFolders enumODF = olFolderInbox;
hr = olNs->GetDefaultFolder(enumODF,&oInbox);
CComQIPtr <Outlook::_Items> NewItems;
hr=oInbox->get_Items(&NewItems);
CComVariant nItem("IPM.Note.MyForm");
IDispatch* itm;
hr=NewItems->Add(nItem,&itm);
_NoteItem *pNoteItem = (_NoteItem *) itm;
CComVariant vEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
hr=pNoteItem->Display(vEmpty);
//-------------------------------------------------------------

I use this in the NewInspector event but this is giving some Access
violation error in hr=pNoteItem->Display(vEmpty);
Anybody have any idea why is it so?Is this the correct way of doing?My idea
is to show the custom form instead of the default form.

Thanks a lotz in Advance
Melbin
 

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

Top