superbipi Newbie
Joined: 27 May 2004 Posts: 5
|
Posted: Mon Apr 03, 2006 9:31 pm Post subject: |
|
|
分享一下作品,更期望高人指點
檔名 vdsping.dsc
Code: |
##define function,tempp
#include icmp.dsc,getip.dsc
dialog CREATE,Ping API By 愛偷窺,-1,0,350,192,
rem *** Modified by Dialog Designer on 2006/4/4 - 02:48 ***
dialog ADD,table,table1,0,0,350,150,"Reply from[110]"|"bytes"[60]|"time"[60]|"status",,COLUMNSORT,
dialog ADD,combo,cb1,150,0,110,20,
list add,cb1,@getip()
list add,cb1,168.95.1.1
list add,cb1,139.175.10.20
list add,cb1,192.168.0.1
list add,cb1,192.168.1.1
dialog set,cb1,@item(cb1,0)
dialog ADD,CHECK,CHECK1,150,115,45,18,數量,1,,click
dialog ADD,SPIN,SPIN1,150,160,48,24,1|254,8
dialog ADD,SPIN,SPIN2,150,210,58,24,1|1000000,50
dialog disable,SPIN2
dialog ADD,BUTTON,BUTTON1,150,270,80,20,PING,,default
dialog ADD,BUTTON,BUTTON2,150,270,80,20,STOP,,default
dialog hide,BUTTON2
dialog add,status,status1,[120]|[100]
dialog SHOW
:EVLOOP
wait EVENT
goto @EVENT()
:CLOSE
exit
:BUTTON2BUTTON
dialog hide,BUTTON2
dialog show,BUTTON1
goto evloop
:BUTTON1BUTTON
dialog hide,BUTTON1
dialog show,BUTTON2
list clear,table1
dialog set,status1,請稍後...
%%succ1 =0
%%succ2 =0
%%succ3 =0
if @dlgtext(CHECK1)
option fieldsep,"."
parse "%1;%2;%3;%4",@dlgtext(cb1)
option fieldsep
%%succ1 =%4
repeat
%%ip =%1.%2.%3.%%succ1
%%yes =@ping(%%ip)
if %%yes
list add,table1,%%ip@tab()%%yes
%%succ2 =@succ(%%succ2)
else
list add,table1,%%ip@tab()time out
%%succ3 =@succ(%%succ3)
end
%%succ1 =@succ(%%succ1)
until @greater(%%succ1,@sum(@dlgtext(SPIN1),@pred(%4)))@event()
else
%%ip =@dlgtext(cb1)
repeat
%%yes =@ping(%%ip)
if %%yes
list add,table1,%%ip@tab()%%yes
%%succ2 =@succ(%%succ2)
else
list add,table1,%%ip@tab()time out
%%succ3 =@succ(%%succ3)
end
%%succ1 =@succ(%%succ1)
until @greater(%%succ1,@pred(@dlgtext(SPIN2)))@event()
end
dialog set,status1,Packets: Sent = @count(table1)@tab()Packets = %%succ2@tab()Lost = %%succ3
dialog hide,BUTTON2
dialog show,BUTTON1
goto EVLOOP
:CHECK1click
if @dlgtext(CHECK1)
dialog enable,SPIN1
dialog disable,SPIN2
else
dialog disable,SPIN1
dialog enable,SPIN2
end
goto evloop
|
檔名 getip.dsc
Code: |
rem #include getip.dsc
#define function,HKL,getip
rem info IP:@cr()@getip()@cr()@cr()IPs:@cr()@getip(IPs)
rem info @getip(ips)
rem exit
:getip
option ERRORTRAP,END1
loadlib IPHlpApi.dll
%r = @BINARY(DWORD,0)
%u = @LIB(iphlpapi,GetIpAddrTable,INT:,0,@ADDR("%R"),True)
%%ret =@val(%R)
if @greater(%%ret,0)
%b =
while @greater(%%ret,@len(%b))
%b =%b@BINARY(byte,0)
wend
%u = @LIB(iphlpapi,GetIpAddrTable,INT:,@ADDR("%b"),@ADDR("%R"),False)
rem info "最大ip數" = @HKL(%b,1,4)
%%ret =@HKL(%b,1,4)
if @equal(%1,ips)
%d =
%%cnt =0
while @greater(%%ret,%%cnt)
%%index =@sum(@prod(24,%%Cnt),5)
%i =@sum(%%index,0)
%%ip =@HKL(%b,%i).@HKL(%b,@sum(%i,1)).@HKL(%b,@sum(%i,2)).@HKL(%b,@sum(%i,3))
if @unequal(@substr(%%ip,1,3),127)
%d =%d%%ip
%i =@sum(%%index,
%d =%d@tab()@HKL(%b,%i).@HKL(%b,@sum(%i,1)).@HKL(%b,@sum(%i,2)).@HKL(%b,@sum(%i,3))@cr()
end
%%cnt =@succ(%%cnt)
wend
else
%d =
%%cnt =0
list create,1
while @greater(%%ret,%%cnt)
%%index =@sum(@prod(24,%%Cnt),5)
%i =@sum(%%index,0)
list add,1,@HKL(%b,%i).@HKL(%b,@sum(%i,1)).@HKL(%b,@sum(%i,2)).@HKL(%b,@sum(%i,3))
%%cnt =@succ(%%cnt)
wend
%%cnt =0
%d =@item(1,0)
while @greater(%%ret,%%cnt)
if @not(@greater(@pos(|@substr(@item(1,%%cnt),1,3),|169|127|192),0))
%d =@item(1,%%cnt)
end
%%cnt =@succ(%%cnt)
wend
list close,1
end
end
freelib IPHlpApi.dll
exit %d
:END1
exit
:HKL
if @numeric(%2%3)
%1 =@val(@substr(%1,%2,%3))
if @greater(%1,2147483647)
%1 = @fsub(%1,4294967296)
end
end
exit %1
|
檔名: icmp.dsc
Code: |
#define function,AddressStringToLong,SocketsInitialize,SocketsCleanup,ping
:ping
%%sdatatosend ="Echo This"
%%ping_timeout =200
%%dwaddress =@AddressStringToLong(%1)
loadlib icmp.dll
loadlib WSOCK32.DLL
%%call =@SocketsInitialize()
%%hport =@LIB(icmp,IcmpCreateFile,INT:)
%r =@fill(2@fill(250)
if @LIB(icmp,IcmpSendEcho,bool:,%%hPort,%%dwAddress,%%sDataToSend,@len(%%sDataToSend),0,@ADDR("%R"),@len(%R),%%PING_TIMEOUT)
#%%address =@val(@substr(%R,1,4))
%%status =@val(@substr(%R,5,)
%%roundtriptime =@val(@substr(%R,9,12))
%%datasize =@val(@substr(%R,13,14))
#%%reserved =@val(@substr(%R,15,16))
#%%datapointer =@val(@substr(%R,17,20))
%%ttl =@val(@substr(%R,21))
#%%tos =@val(@substr(%R,22))
#%%flags =@val(@substr(%R,23))
#%%optionssize =@val(@substr(%R,24))
#%%optionsdata =@val(@substr(%R,25,2)
#%%data =@substr(%R,29,@sum(28,250))
%%ping =%%DataSize@tab()%%RoundTripTime@tab()%%status@tab()%%Ttl
else
rem %%ping =@HKL(%R,13,14)@tab()@HKL(%R,9,12)@tab()@prod(@HKL(%R,5,,-1)@tab()@HKL(%R,21)
%%ping =
end
%%call =@LIB(icmp,IcmpCloseHandle,INT:,%%hPort)
%%call =@SocketsCleanup()
freelib icmp.dll
freelib WSOCK32.DLL
exit %%ping
:SocketsCleanup
%x =@LIB(WSOCK32,WSACleanup,INT:)
if @unequal(%x,0)
info "Windows Sockets error " %x " occurred in Cleanup."
exit
end
exit 1
:SocketsInitialize
%%ws_version_reqd =$101
%w =@fill(398)
%x =@LIB(WSOCK32,WSAStartup,INT:,%%WS_VERSION_REQD,@addr("%W"))
if @unequal(%x,0)
info "Windows Sockets for 32 bit Windows environments is not successfully responding."
exit
end
exit 1
:AddressStringToLong
%%fsep =@fsep()
option fieldsep,"."
parse "%1;%2;%3;%4",%1
option fieldsep,%%fsep
if @both(@both(%1,%2),@both(%3,%4))
exit @sum($@hex(%4,2)@hex(%3,2)@hex(%2,2)@hex(%1,2))
end
exit 0
|
其中使用過前輩技術
若有侵權請多包含 |
|