主题:  电子邮件

gcnie

职务:普通成员
等级:1
金币:0.0
发贴:55
#12002/5/18 9:28:19
如何实现点击邮件地址自动打开默认的邮件发送程序,并已输入收件人地址.不用老张的扩展函数.



魔岩

职务:版主
等级:6
金币:34.0
发贴:4453
#22002/5/18 13:54:58
ShellExecuteA是shell32.dll(该DLL在系统目录里)里封装的一个函数,可以实现你的功能。
以下的代码可以用自动打开默认的邮件发送程序:
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net","","",5)
以下的代码可以用自动打开默认的邮件发送程序(有主题):
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net?Subject=This is the subject","","",5)
以下的代码可以用自动打开默认的邮件发送程序(有主题,抄送):
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net?Subject=This is the subject&cc=hello@5dmedia.com","","",5)
以下的代码可以用自动打开默认的邮件发送程序(有主题,抄送,密件抄送):
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net?Subject=This is the subject&cc=hello@5dmedia.com&bcc=rock@rockstudio.com","","",5)
以下的代码可以用自动打开默认的邮件发送程序(有主题,抄送,密件抄送,邮件内容):
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net?Subject=This is the subject&cc=hello@5dmeida.com&bcc=rock@rockstudio.com&body=This is the body of the mail. This is another sentence.","","",5)
以下的代码可以发送多人:
ShellExecuteA(windowhandle, "open","mailto:hellrock@163net;hellyun@love.com?Subject=This is the subject&body=This is the body of the mail. This is another sentence.","","",5)
以下代码可以抄送多人:
ShellExecuteA(windowhandle, "open","mailto:hellrock@163.net?Subject=This is the subject&cc=hellrock@5dmedia.com;friend@5dmedia.com&body=This is the body of the mail. This is another sentence.","","",5)

以下为ShellExecuteA的API声明相关内容:
Function Name :ShellExecuteA
Parameters:Long,String,String,String,String,Long
Return value :Long