再加100分求就在2003调用系统的新建联系人界面解决方法

再加100分求就在2003调用系统的新建联系人界面
我的程序中要求添加新的联系人,所以想调用系统新建联系人界面,有熟悉的给点建议
我的平台是2003
http://community.csdn.net/Expert/topic/5652/5652244.xml?temp=.29797

------解决方案--------------------
ChooseContact()这个可以吗~
HRESULT ContactChooserExample()
{
HRESULT hr = E_FAIL;
const CEPROPID c_propidAllEmail = PIMPR_ALL_EMAIL;
CHOOSECONTACT cc = {0};

// Setup the CHOOSECONTACT structure.
cc.cbSize = sizeof (cc);
cc.dwFlags = CCF_RETURNCONTACTNAME | CCF_RETURNPROPERTYVALUE | CCF_HIDENEW;
cc.rgpropidRequiredProperties = &c_propidAllEmail;
// Number of properties specified in the c_propidAllEmail array.
cc.cRequiredProperties = 1;
cc.hwndOwner = NULL;

// Display the Contact Chooser control and prompt the user to choose a contact.
hr = ChooseContact(&cc);

// The name and a string representation of the property is returned according to
// the flags set in the CHOOSECONTACT structure above.
DEBUGMSG(TRUE, (L "%s 's email address is %s ",
cc.bstrContactName, cc.bstrPropertyValueSelected));

// Free memory.
SysFreeString(cc.bstrContactName);
SysFreeString(cc.bstrPropertyValueSelected);

return hr;
}

------解决方案--------------------
在03上没有ChooseContact()
------解决方案--------------------
打劫,分数交出来,内裤也交出来。
------解决方案--------------------
呵呵,分数好说,重要的是能解决你的问题。

把WM5的那个函数略改造一下就能为03版所用,但是显示不了Edit tab,只能是Summary tab。如下:

HRESULT CreateAndDisplyContact(HWND hwndParent)
{
HRESULT hr = E_FAIL;
IPOutlookApp * pOutApp = NULL;
IDispatch *pDisp = NULL;
IContact *pContact = NULL;

hr = InitPOOM2();
CHR(hr);
// Create a new item.
if (GetPoomApp(&pOutApp))
{
OlItemType olItemType = olContactItem;
if (SUCCEEDED(pOutApp-> CreateItem(olItemType, &pDisp))) //
{
// Get the IContact interface the newly created item.
hr = pDisp-> QueryInterface(IID_IContact, (LPVOID*)&pContact);
CHR(hr);
// 只能调用Display方法,显示 Summary tab
hr = pContact-> Display(hwndParent);
CHR(hr);
}
}
Error:
RELEASE_OBJ(pDisp);
RELEASE_OBJ(pContact);
RELEASE_OBJ(pOutApp);
UnInitPOOM2();
return hr;
}

上面的代码在得到IContact接口的指针时使用了QueryInterface的方式,也可以直接得到这个指针,参考那个CreateAnItem函数。