如何调用NetMessageBufferSend发送消息?(改编)

<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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值