200分求写OutLook Express的联系人文件(Wab文件)的Demo

chenjun 2004-10-06 07:32:32
我想将的数据库中的联系人信息导出到OutLook Express的联系人文件中(或写成Wab文件也行),我在网上找了好久都没有找到这方面的资料,除了找到一个Wab.zip的Demo,但是在增加联系人时它是调用了OutLook Express的输入窗口来输入内容的,我不需要这个窗口,因为我的联系人信息都在数据库中了,我只需要做一个循环将数据库中的内容写到Wab文件中即可,哪位大虾有这方面的Demo呀!成功了,200分全部送上。

因提问时最多只能给100分,解决后我会另外起个帖子给分的。
...全文
257 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenjun 2004-12-03
  • 打赏
  • 举报
回复
这里有一段C语言的代码,有谁能翻译成Delphi的代码呀?
HRESULT TestAddress(LPMESSAGE pMsg)
{
HRESULT hRes = S_OK; // Status code of MAPI calls
LPADRLIST pAdrList = NULL; // ModifyRecips takes LPADRLIST

// Allocate memory for new SRowSet structure.
hRes = MAPIAllocateBuffer(CbNewSRowSet(1),(LPVOID*) &pAdrList)

// If memory allocation fails, quit.
if ( FAILED ( hres ) )
goto Quit;

// Zero out allocated memory.
ZeroMemory ( pAdrList, CbNewSRowSet(1));

// Allocate memory for SPropValue structure that indicates what
// recipient properties will be set. NUM_RECIP_PROPS == 5.
hRes = MAPIAllocateBuffer(NUM_RECIP_PROPS * sizeof(SPropValue),
(LPVOID*) &(pAdrList->aEntries[0].rgPropVals);

// If memory allocation fails, quit.
if ( FAILED ( hRes ) )
goto Quit;

// Zero out allocated memory.
ZeroMemory ( pAdrList -> aEntries[0].rgPropVals,
NUM_RECIP_PROPS * sizeof(SPropValue) );

// Setup the One Time recipient by indicating how many recipients
// and how many properties will be set on each recipient.

pAdrList->cEntries = 1; // How many recipients.
pAdrList->aEntries[0].cValues = 5; // How many properties
// per recipient

// Set the SPropValue members == the desired values.
pAdrList->aEntries[0].rgPropVals[NAME].ulPropTag = PR_DISPLAY_NAME;
pAdrList->aEntries[0].rgPropVals[NAME].lpszA = "<Display Name>";

pAdrList->aEntries[0].rgPropVals[ADDR].ulPropTag = PR_ADDRTYPE;
pAdrList->aEntries[0].rgPropVals[ADDR].lpszA = "SMTP";

pAdrList->aEntries[0].rgPropVals[EMAIL].ulPropTag=PR_EMAIL_ADDRESS;
pAdrList->aEntries[0].rgPropVals[EMAIL].lpszA = "<email address>";

pAdrList->aEntries[0].rgPropVals[RECIP].ulPropTag=R_RECIPIENT_TYPE;
pAdrList->aEntries[0].rgPropVals[RECIP].Value.l = MAPI_TO;

pAdrList->aEntries[0].rgPropVals[EID].ulPropTag = PR_ENTRYID;

// Create the One-off address and get an EID for it.
hRes = m_pAddrBook->CreateOneOff(
pAdrList-> aEntries[0].rgPropVals[NAME].Value.lpszA,
pAdrList-> aEntries[0].rgPropVals[ADDR].Value.lpszA,
pAdrList-> aEntries[0].rgPropVals[EMAIL].Value.lpszA,
0,
&(pAdrList->aEntries[0].rgPropVals[EID].Value.bin.cb),
(LPENTRYID *)
(&pAdrList->aEntries[0].rgPropVals[EID].Value.bin.lpb));

// If the call to CreateOneOff fails, quit.
if ( FAILED ( hRes ) )
goto Quit;

// Attempt to resolve the new address list. If the attempt fails,
// quit.
if ( FAILED ( hRes = m_pAddrBook -> ResolveName ( 0L,
0L,
NULL,
pAdrList ) ) )
goto Quit;

// If everything goes right, add the new recipient to the message
// object passed into us.
hRes = pMsg->ModifyRecipients(MODRECIP_ADD,pAdrList);

Quit:
// Always release any newly created objects and allocated memory.
FreePadrlist(pAdrList);

return hRes;
}
hsmserver 2004-10-07
  • 打赏
  • 举报
回复
不掉用OutLook Express的输入窗口那就有点麻烦了
你得清楚OutLook Express把数据以什么格式,或者存放到哪了
todouwang 2004-10-07
  • 打赏
  • 举报
回复
http://www.delphiun.com那里有不少代码,你去找找看吧
chenjun 2004-10-07
  • 打赏
  • 举报
回复
没有人会吗
chenjun 2004-10-07
  • 打赏
  • 举报
回复
这不是我要的方法
hsmserver 2004-10-07
  • 打赏
  • 举报
回复
刚仔细看了一下
OutLook Express支持从文本文件导入的
也就是说你把数据生成。TXT文件就可以了,
然后再控制OutLook Express完成导入功能。

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧