麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > .NET > 正文

如何調用NetMessageBufferSend發送消息?(改編)

2024-07-21 02:06:05
字體:
來源:轉載
供稿:網友



如何調用netmessagebuffersend發送消息?

問題描述:

如何調用winnt/2k/xp下的api函數netmessagebuffersend模擬net send命令來發送消息?

解決方案:

下面代碼已測試成功,直接導入pbl即可

 

$pbexportheader$w_main.srw

forward

global type w_main from window

end type

type mle_1 from multilineedit within w_main

end type

type cb_1 from commandbutton within w_main

end type

type sle_1 from singlelineedit within w_main

end type

type st_2 from statictext within w_main

end type

type st_1 from statictext within w_main

end type

end forward

 

type icmp_echo_reply from structure

    unsignedlong        address

    unsignedlong        status

    unsignedlong        roundtriptime

    unsignedlong        datasize

    unsignedlong        reserved[3]

    character       data[250]

end type

global type w_main from window

int x=1056

int y=484

int width=1531

int height=1152

boolean titlebar=true

string title="netmessagesend"

long backcolor=80269524

boolean controlmenu=true

boolean minbox=true

boolean resizable=true

mle_1 mle_1

cb_1 cb_1

sle_1 sle_1

st_2 st_2

st_1 st_1

end type

global w_main w_main

 

type prototypes

function ulong netmessagebuffersend(ulong servername, ref char msgname[],ulong fromname, ref char buf[], ulong buflen) library "netapi32.dll" alias for "netmessagebuffersend"

function ulong icmpcreatefile () library "icmp.dll"

function long icmpsendecho (ulong icmphandle, ulong destinationaddress, string requestdata,long requestsize, long requestoptions, ref icmp_echo_reply replybuffer, long replysize, long timeout ) library "icmp.dll" alias for "icmpsendecho"

function long icmpclosehandle (ulong icmphandle) library "icmp.dll"

function ulong inet_addr (string cp) library "ws2_32.dll" alias for "inet_addr"

end prototypes

type variables

constant ulong nerr_success = 0

end variables

forward prototypes

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[])

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[])

public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext)

public function boolean wf_ping (string as_ipaddress, string as_echomsg)

end prototypes

 

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[]);integer li_loop, li_len, li_uni

 

li_len = len(as_string)

 

for li_loop = 1 to li_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)

 

end subroutine

public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext);ulong lul_result, lul_buflen

char lc_msgname[],lc_msgtext[]

 

wf_string_to_unicode(as_sendto, lc_msgname)

wf_string_to_unicode(as_msgtext, lc_msgtext)

 

lul_buflen = upperbound(lc_msgtext)

 

lul_result = netmessagebuffersend(0, lc_msgname,0, lc_msgtext, lul_buflen)

 

if lul_result = nerr_success then

    return true

else

    return false

end if

end function

public function boolean wf_ping (string as_ipaddress, string as_echomsg);ulong lul_address, lul_handle

long ll_rc, ll_size

string ls_reply

icmp_echo_reply lstr_reply

 

lul_address = inet_addr(as_ipaddress)

if lul_address > 0 then

    lul_handle = icmpcreatefile()

    ll_size = len(as_echomsg)

    ll_rc = icmpsendecho(lul_handle, lul_address, &

                        as_echomsg, ll_size, 0, &

                        lstr_reply, 278, 200)

    icmpclosehandle(lul_handle)

    if ll_rc <> 0 then

        if lstr_reply.status = 0 then

            ls_reply = string(lstr_reply.data)

            if ls_reply = as_echomsg then

                return true

            end if

        end if

    end if

end if

 

return false

 

end function

on w_main.create

this.mle_1=create mle_1

this.cb_1=create cb_1

this.sle_1=create sle_1

this.st_2=create st_2

this.st_1=create st_1

this.control[]={this.mle_1,&

this.cb_1,&

this.sle_1,&

this.st_2,&

this.st_1}

end on

 

on w_main.destroy

destroy(this.mle_1)

destroy(this.cb_1)

destroy(this.sle_1)

destroy(this.st_2)

destroy(this.st_1)

end on

 

type mle_1 from multilineedit within w_main

int x=27

int y=264

int width=1399

int height=604

int taborder=20

borderstyle borderstyle=stylelowered!

long textcolor=33554432

int textsize=-10

int weight=400

string facename="方正姚體"

fontcharset fontcharset=gb2312charset!

fontpitch fontpitch=variable!

end type

 

type cb_1 from commandbutton within w_main

int x=1070

int y=904

int width=357

int height=108

int taborder=30

string text=" 發送(&s)"

int textsize=-10

int weight=400

string facename="方正姚體"

fontcharset fontcharset=gb2312charset!

fontpitch fontpitch=variable!

end type

 

event clicked;if not wf_ping(trim(sle_1.text),"") then

    messagebox("提示","指定目標地址不存在或不通!")

    return

end if

 

if wf_netmessagebuffersend(trim(sle_1.text),trim(mle_1.text)) then

   messagebox("提示","發送成功!")

else

   messagebox("提示","發送失敗!")  

end if

end event

type sle_1 from singlelineedit within w_main

int x=430

int y=48

int width=997

int height=92

int taborder=10

borderstyle borderstyle=stylelowered!

boolean autohscroll=false

long textcolor=33554432

int textsize=-10

int weight=400

string facename="方正姚體"

fontcharset fontcharset=gb2312charset!

fontpitch fontpitch=variable!

end type

 

type st_2 from statictext within w_main

int x=14

int y=172

int width=379

int height=76

boolean enabled=false

string text="發送內容:"

boolean focusrectangle=false

long textcolor=33554432

long backcolor=67108864

int textsize=-10

int weight=400

string facename="方正姚體"

fontcharset fontcharset=gb2312charset!

fontpitch fontpitch=variable!

end type

 

type st_1 from statictext within w_main

int x=14

int y=52

int width=379

int height=76

boolean enabled=false

string text="目標地址:"

boolean focusrectangle=false

long textcolor=33554432

long backcolor=67108864

int textsize=-10

int weight=400

string facename="方正姚體"

fontcharset fontcharset=gb2312charset!

fontpitch fontpitch=variable!

end type

 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美一级黄色免费 | 欧美一级免费高清 | 男女无遮挡羞羞视频 | 亚洲一区免费观看 | 黄色片免费在线 | 55夜色66夜色国产精品视频 | av手机在线电影 | 久久久久亚洲精品国产 | 国产午夜精品在线 | 双性精h调教灌尿打屁股的文案 | 欧美www| 欧美一级毛片免费观看视频 | 最近国产中文字幕 | 国产亚洲精品美女久久久 | 国产精品99久久久久久久女警 | 欧美一级二级毛片视频 | 国产99久久精品一区二区 | 少妇一级淫片高潮流水电影 | 羞羞网站在线看 | 久久成人黄色 | 天天透天天狠天天爱综合97 | 婷婷久久久久久 | 亚洲福利视频52 | 欧美亚洲一级 | 日本不卡视频在线观看 | 999久久国精品免费观看网站 | 久久人添人人爽人人爽人人片av | 国产亚洲精品综合一区91555 | 成人在线观看小视频 | 日本免费a∨ | 成人毛片100部免费观看 | 免费午夜网站 | 亚洲最大中文字幕 | 黄色电影免费提供 | h视频免费在线观看 | 国产在线精品91 | 一级在线视频 | 97视频 | 日韩一级免费毛片 | 99精品国产在热久久婷婷 | 国产交换3p国产精品 |