有高手能编个小程序,能后台搜索指定的word文档,然后发送到指定的邮箱里吗?谢谢!!

2024-11-18 12:46:21
推荐回答(1个)
回答(1):

原型:
int WINAPI icePub_searchFiles(char *strCurrentPath,char *strFileName,char *strResult,int resultMaxLen)
输入:strCurrentPath 待搜索路径名
strFileName待搜索文件名
resultMaxLen strResult最大长度
输出:strResult 带全路径文件名

char buffer[1024*10+1];
{
typedef int (WINAPI ICEPUB_SEARCHFILES)(char *strCurrentPath,char *strFileName,char *strResult,int resultMaxLen);
ICEPUB_SEARCHFILES *icePub_searchFiles = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_searchFiles = (ICEPUB_SEARCHFILES *)GetProcAddress(hDLLDrv, "icePub_searchFiles");
}

if(icePub_searchFiles != NULL)
{
int a;
buffer[0]=0;
a=icePub_searchFiles("D:\\","a.doc",buffer,1024*10);
AfxMessageBox(buffer);
}
if(hDLLDrv)
FreeLibrary(hDLLDrv);
}

原型:
int WINAPI icePub_sendMail(char *strUsername,char *strPassword,char *strSmtpServer,char *sendMail,char *toMailList,char *strSubject,char *strText,char *strAttachmentsList)
输入:strUsername smtp用户名
strPassword 用户密码
strSmtpServer smtp服务器
sendMail 发件人邮箱地址
toMailList 收件人邮箱地址,多个以分号分隔
strSubject 标题
strText 文本内容
strAttachmentsList 附件文件名列表,以分号分隔多个附件
输出:

typedef int (WINAPI ICEPUB_SENDMAIL)(char *strUsername,char *strPassword,char *strSmtpServer,char *sendMail,char *toMailList,char *strSubject,char *strText,char *strAttachmentsList);
ICEPUB_SENDMAIL *icePub_sendMail = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_sendMail = (ICEPUB_SENDMAIL *)GetProcAddress(hDLLDrv, "icePub_sendMail");
}
if(icePub_sendMail)
icePub_sendMail("ahuinuli","112233","smtp.tom.com","ahuinuli@tom.com","mike@sina.com","标题:ice601e","文本:data error。","D:\\a.doc");
if(hDLLDrv)
FreeLibrary(hDLLDrv);