| 发表于:2007-06-14 20:50:38 楼主 |
下一个在局域网内发消息的程序源代码,结果在办公室里运行,有的机子可以,有的不可以。办公室的机子全部xp操作系统的,机子也全部都可以连接。请问是否和机子的设置有关?如何修改? private declare function netmessagebuffersend lib "netapi32.dll " (server as any, ytoname as byte, yfromname as any, ymsg as byte, byval lsize as long) as long private sub command1_click() dim x as boolean x = sendmsg(txtto.text, txtfrom.text, txtmsg.text) if x then msgbox "消息已被成功发送 ", vbinformation, "发送消息 " else msgbox "发送消息失败 ", vbcritical, "发送消息 " end if end sub private function sendmsg(stouser as string, sfromuser as string, smessage as string) as boolean dim ytoname() as byte dim yfromname() as byte dim ymsg() as byte dim l as long ytoname = stouser & vbnullchar yfromname = sfromuser & vbnullchar ymsg = smessage & vbnullchar if netmessagebuffersend(byval 0&, ytoname(0), byval 0&, ymsg(0), ubound(ymsg)) = nerr_success then sendmsg = true end if end function |
|
|
|
|