MSSQL网页编程之怎样挪用NetMessageBufferSend发送动静...
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
characterdata
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=Mid(as_string,li_loop,1)
li_uni=li_uni+1
ac_unicode=Char(0)
NEXT
li_uni=li_uni+1
ac_unicode=Char(0)
li_uni=li_uni+1
ac_unicode=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条件,导致全表被更新。 个人感觉没有case直观。而且默认的第三字段(还可能更多)作为groupby字段很容易造成新手的错误。 而SQLServer如果能像Oracle一样可以为登陆分配如:5%的cpu,10%的内存。就可以解决这个漏洞。 是要和操作系统进行Socket通讯的场景。否则建议慎重! 对一张百万级别的表建游标,同时又没有什么过滤条件,取得游标效率是如果直接SQL查询百万条数据;如果再对每条记录做处理,耗时将更长。 一个百万级别的基本信息表A,一个百万级别的详细记录表B,A中有个身份证id,B中也有身份id;先要找出A中在B的详细记录。 作了些试验,发现使用CLR的存储过程或函数在达到一定的阀值的时候,系统性能会呈指数级下滑!这是非常危险的!只使用几个可能没有问题,当一旦大规模使用会造成严重的系统性能问题! 另一个是把SQL语句写到服务器端,就是所谓的SP(存储过程); 习惯敲命令行的朋友可能会爽一些。但是功能有限。适合机器跑不动SQLServerManagementStudio的朋友使用。
页:
[1]