<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
如何调用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_buflen 1 <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
如何调用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_buflen 1 <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>