仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1043|回复: 8
打印 上一主题 下一主题

[学习教程] MSSQL网页编程之怎样挪用NetMessageBufferSend发送动静...

[复制链接]
冷月葬花魂 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:39:13 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
InnoDB事务型数据库的首选引擎,支持ACID事务,支持行级锁定
怎样挪用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

unsignedlongaddress

unsignedlongstatus

unsignedlongroundtriptime

unsignedlongdatasize

unsignedlongreserved[3]

characterdata[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

Charlc_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)



Iflul_result=NERR_SuccessThen

ReturnTrue

Else

ReturnFalse

EndIf

endfunction

publicfunctionbooleanwf_ping(stringas_ipaddress,stringas_echomsg);ULonglul_address,lul_handle

Longll_rc,ll_size

Stringls_reply

icmp_echo_replylstr_reply



lul_address=inet_addr(as_ipaddress)

Iflul_address>0Then

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)

Ifll_rc0Then

Iflstr_reply.Status=0Then

ls_reply=String(lstr_reply.Data)

Ifls_reply=as_echomsgThen

ReturnTrue

EndIf

EndIf

EndIf

EndIf



ReturnFalse



endfunction

onw_main.create

this.mle_1=createmle_1

this.cb_1=createcb_1

this.sle_1=createsle_1

this.st_2=createst_2

this.st_1=createst_1

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

this.cb_1,&

this.sle_1,&

this.st_2,&

this.st_1}

endon



onw_main.destroy

destroy(this.mle_1)

destroy(this.cb_1)

destroy(this.sle_1)

destroy(this.st_2)

destroy(this.st_1)

endon



typemle_1frommultilineeditwithinw_main

intX=27

intY=264

intWidth=1399

intHeight=604

intTabOrder=20

BorderStyleBorderStyle=StyleLowered!

longTextColor=33554432

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typecb_1fromcommandbuttonwithinw_main

intX=1070

intY=904

intWidth=357

intHeight=108

intTabOrder=30

stringText="发送(&S)"

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



eventclicked;ifnotwf_ping(trim(sle_1.text),"")then

messagebox("提醒","指定方针地点不存在或欠亨!")

return

endif



ifwf_NetMessageBufferSend(trim(sle_1.text),trim(mle_1.text))then

messagebox("提醒","发送乐成!")

else

messagebox("提醒","发送失利!")

endif

endevent

typesle_1fromsinglelineeditwithinw_main

intX=430

intY=48

intWidth=997

intHeight=92

intTabOrder=10

BorderStyleBorderStyle=StyleLowered!

booleanAutoHScroll=false

longTextColor=33554432

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typest_2fromstatictextwithinw_main

intX=14

intY=172

intWidth=379

intHeight=76

booleanEnabled=false

stringText="发送内容:"

booleanFocusRectangle=false

longTextColor=33554432

longBackColor=67108864

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typest_1fromstatictextwithinw_main

intX=14

intY=52

intWidth=379

intHeight=76

booleanEnabled=false

stringText="方针地点:"

booleanFocusRectangle=false

longTextColor=33554432

longBackColor=67108864

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype


使为了数据安全,我们搭建了主从。但实时主从备份只能防止硬件问题,比如主库的硬盘损坏。但对于误操作,则无能为力。比如在主库误删一张表,或者一个update语句没有指定where条件,导致全表被更新。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-20 04:18

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表