如何调用NetMessageBufferSend发送消息?(改编)
2008-04-26 15:13
543 查看
如何调用NetMessageBufferSend发送消息?
问题描述:
如何调用WINNT/2K/XP下的API函数NetMessageBufferSend模拟netsend命令来发送消息?
解决方案:
下面代码已测试成功,直接导入PBL即可
$PBExportHeader$w_main.srw
forward
globaltypew_mainfromWindow
endtype
typemle_1frommultilineeditwithinw_main
endtype
typecb_1fromcommandbuttonwithinw_main
endtype
typesle_1fromsinglelineeditwithinw_main
endtype
typest_2fromstatictextwithinw_main
endtype
typest_1fromstatictextwithinw_main
endtype
endforward
typeicmp_echo_replyfromstructure
unsignedlong address
unsignedlong status
unsignedlong roundtriptime
unsignedlong datasize
unsignedlong reserved[3]
character data[250]
endtype
globaltypew_mainfromWindow
intX=1056
intY=484
intWidth=1531
intHeight=1152
booleanTitleBar=true
stringTitle="NETMESSAGESEND"
longBackColor=80269524
booleanControlMenu=true
booleanMinBox=true
booleanResizable=true
mle_1mle_1
cb_1cb_1
sle_1sle_1
st_2st_2
st_1st_1
endtype
globalw_mainw_main
typeprototypes
FunctionulongNetMessageBufferSend(ulongservername,refcharmsgname[],ulongfromname,refcharbuf[],ulongbuflen)Library"netapi32.dll"Aliasfor"NetMessageBufferSend"
FunctionulongIcmpCreateFile()Library"icmp.dll"
FunctionlongIcmpSendEcho(ulongIcmpHandle,ulongDestinationAddress,stringRequestData,longRequestSize,longRequestOptions,Reficmp_echo_replyReplyBuffer,longReplySize,longTimeout)Library"icmp.dll"Aliasfor"IcmpSendEcho"
FunctionlongIcmpCloseHandle(ulongIcmpHandle)Library"icmp.dll"
Functionulonginet_addr(stringcp)Library"ws2_32.dll"Aliasfor"inet_addr"
endprototypes
typevariables
CONSTANTulongNERR_Success=0
endvariables
forwardprototypes
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])
publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext)
publicfunctionbooleanwf_ping(stringas_ipaddress,stringas_echomsg)
endprototypes
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[]);Integerli_loop,li_len,li_uni
li_len=Len(as_string)
FORli_loop=1TOli_len
li_uni=li_uni+1
ac_unicode[li_uni]=Mid(as_string,li_loop,1)
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
NEXT
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
endsubroutine
publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext);Ulonglul_result,lul_buflen1
问题描述:
如何调用WINNT/2K/XP下的API函数NetMessageBufferSend模拟netsend命令来发送消息?
解决方案:
下面代码已测试成功,直接导入PBL即可
$PBExportHeader$w_main.srw
forward
globaltypew_mainfromWindow
endtype
typemle_1frommultilineeditwithinw_main
endtype
typecb_1fromcommandbuttonwithinw_main
endtype
typesle_1fromsinglelineeditwithinw_main
endtype
typest_2fromstatictextwithinw_main
endtype
typest_1fromstatictextwithinw_main
endtype
endforward
typeicmp_echo_replyfromstructure
unsignedlong address
unsignedlong status
unsignedlong roundtriptime
unsignedlong datasize
unsignedlong reserved[3]
character data[250]
endtype
globaltypew_mainfromWindow
intX=1056
intY=484
intWidth=1531
intHeight=1152
booleanTitleBar=true
stringTitle="NETMESSAGESEND"
longBackColor=80269524
booleanControlMenu=true
booleanMinBox=true
booleanResizable=true
mle_1mle_1
cb_1cb_1
sle_1sle_1
st_2st_2
st_1st_1
endtype
globalw_mainw_main
typeprototypes
FunctionulongNetMessageBufferSend(ulongservername,refcharmsgname[],ulongfromname,refcharbuf[],ulongbuflen)Library"netapi32.dll"Aliasfor"NetMessageBufferSend"
FunctionulongIcmpCreateFile()Library"icmp.dll"
FunctionlongIcmpSendEcho(ulongIcmpHandle,ulongDestinationAddress,stringRequestData,longRequestSize,longRequestOptions,Reficmp_echo_replyReplyBuffer,longReplySize,longTimeout)Library"icmp.dll"Aliasfor"IcmpSendEcho"
FunctionlongIcmpCloseHandle(ulongIcmpHandle)Library"icmp.dll"
Functionulonginet_addr(stringcp)Library"ws2_32.dll"Aliasfor"inet_addr"
endprototypes
typevariables
CONSTANTulongNERR_Success=0
endvariables
forwardprototypes
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])
publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext)
publicfunctionbooleanwf_ping(stringas_ipaddress,stringas_echomsg)
endprototypes
publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[]);Integerli_loop,li_len,li_uni
li_len=Len(as_string)
FORli_loop=1TOli_len
li_uni=li_uni+1
ac_unicode[li_uni]=Mid(as_string,li_loop,1)
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
NEXT
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
li_uni=li_uni+1
ac_unicode[li_uni]=Char(0)
endsubroutine
publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext);Ulonglul_result,lul_buflen1
相关文章推荐
- 如何调用NetMessageBufferSend发送消息?(改编)
- pb利用NetMessageBufferSend在局域网发送中文消息(实现cmd中 NET SEND功能)
- C#调用net.exe发送消息
- 如何在Qt中处理(接收/发送)MFC或Windows消息(message)
- NET中如何发送广播消息
- 【C#】无损转换Image为Icon 【C#】组件发布:MessageTip,轻快型消息提示窗 【C#】给无窗口的进程发送消息 【手记】WebBrowser响应页面中的blank开新窗口及window.close关闭本窗体 【手记】调用Process.EnterDebugMode引发异常:并非所有引用的特权或组都分配给呼叫方 【C#】DataRowState演变备忘
- C#调用net.exe发送消息
- C#调用net.exe发送消息
- netmessagebuffersend示例
- 如何在ASP调用一个用C#.NET(2005)写成的类?
- Axis 调用.net WebServic接口出现:验证消息的安全性时错误发生
- ASP.NET发送ICQ消息DIY
- F5当刷新页面,出现“要再次显示此页,web该浏览器,你曾经有过发送消息再次提交...点击重试",如何防止此对话框解决方案的出现,
- 使用Ext.net或者ExtJS时,如何在调用Grid.save()或者Store.save()传递更多的参数到后台
- 【学习】MFC 如何处理发送给线程的消息
- 如何利用POST数据到web页面接口(包括调用页面发送json数据和页面后台接受json数据)
- 如何向SysListView32里的某一行发送双击消息
- 如何通过C#.NET中的反射机制来创建C#.NET泛型类的实例,并调用其方法??
- asp.net如何调用js中的函数function
- 如何在底层发送toast消息