Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiping
#1
How Can I monitor multiple IP addresses and see if any drops?
#2
Like this?
http://www.download.com/Free-IP-Scanner ... 41308.html

Use IntPing with rep. Maybe in multiple threads.

out IntPing("http://84.32.123.7")
out IntPing("http://84.32.123.19")
#3
Yes.

but

Macro
Code:
Copy      Help
rep 50
,0.5
,out IntPing("http://84.32.123.7")

always ret 1
#4
IntPing calls Windows API function InternetCheckConnection. It returns 0 for some ips that in free ip scanner are green. Maybe better to use some other functions, but now I don't know.
#5
I tried

Function pings
Trigger CN7     Help - how to add the trigger to the macro
Code:
Copy      Help
str controls = "7 8 9 10"
str e7 e8 e9 e10
if(!ShowDialog("pings" 0 &controls 0 0 0 0 0 10 0.5)) ret

ArrangeWindows 1
if(e10.len)
,str comando.format("/K ping -t %s" e10)
,run "%COMSPEC%" comando
,int hwnd=win
,0.25
,str temp.format("Rama D - %s" e10)
,temp.setwintext(hwnd)
if(e9.len)
,comando.format("/K ping -t %s" e9)
,run "%COMSPEC%" comando
,hwnd=win
,0.25
,temp.format("Rama C - %s" e9)
,temp.setwintext(hwnd)
if(e8.len)
,comando.format("/K ping -t %s" e8)
,run "%COMSPEC%" comando
,hwnd=win
,0.25
,temp.format("Rama B - %s" e8)
,temp.setwintext(hwnd)
if(e7.len)
,comando.format("/K ping -t %s" e7)
,run "%COMSPEC%" comando
,hwnd=win
,0.25
,temp.format("Rama A - %s" e7)
,temp.setwintext(hwnd)

ArrangeWindows 4

;BEGIN DIALOG
;0 "" 0x90CA0A44 0x100 0 0 127 135 "Pings"
;7 Edit 0x54030080 0x200 30 14 68 14 ""
;8 Edit 0x54030080 0x200 30 34 68 14 ""
;9 Edit 0x54030080 0x200 30 52 68 14 ""
;10 Edit 0x54030080 0x200 30 72 68 14 ""
;1 Button 0x54030001 0x4 12 116 48 14 "Ping"
;2 Button 0x54030000 0x4 66 116 48 14 "Cancel"
;3 Static 0x54000000 0x0 12 16 18 12 "A:"
;4 Static 0x54000000 0x0 12 36 18 13 "B:"
;5 Static 0x54000000 0x0 12 54 18 12 "C:"
;6 Static 0x54000000 0x0 12 74 18 12 "D:"
;7 Edit 0x54030080 0x200 30 14 68 14 ""
;8 Edit 0x54030080 0x200 30 34 68 14 ""
;9 Edit 0x54030080 0x200 30 52 68 14 ""
;10 Edit 0x54030080 0x200 30 72 68 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020002 "" ""

It would be possible to create something like this in a QM dialog?

Note: another program that does this: http://www.tools4ever.com/products/free/freeping/
#6
At first we need good ping function. Maybe source code is somewhere on the internet. IntPing works with http urls, but don't know can it work with computers that are not http servers.
#7
Does http://www.shinesoft.com/comp/ping.html help?
#8
Function Ping
Code:
Copy      Help
;/
function# $dest [&TTL] [timeout]

;Sends an ICMP echo request to an internet or network computer.
;It is called "ping", and is used to see if we can connect to a computer, and how quickly.
;Returns roundtrip time, in milliseconds. If cannot connect, returns 0. Does not throw errors.
;Uses the same Windows API functions as ping.exe.
;Note that some ICMP packets may be lost. Then the function returns 0. Call it several times to make more reliable. Don't ping too frequently.
;If you will use this function in a dialog, you should call it in other thread.

;dest - ip (eg "123.456.78.90"), or web server address (eg "www.qweryzxcv.com"), or network computer name, or "" for this computer. The function returns 0 if dest is invalid or cannot be resolved.
;TTL - receives TTL. Default: 0.
;timeout - timeout in milliseconds. Default: 1000. The function returns 0 if not connected during that time.

;EXAMPLE
;str dest="www.google.com"
;int t ttl
;t=Ping(dest ttl)
;if(t) out "Ping %s: bytes=32 time=%i TTL=%i" dest t ttl
;else out "Ping %s: failed" dest


type IP_OPTION_INFORMATION !Ttl !Tos !Flags !OptionsSize !*OptionsData
type ICMP_ECHO_REPLY Address Status RoundTripTime @DataSize @Reserved !*Data IP_OPTION_INFORMATION'Options
int+ __icmp_ev; if(!__icmp_ev) __icmp_ev=1; SetEnvVar "icmp_dll" iif(_winver=0x500 "icmp" "iphlpapi")
dll- "%icmp_dll%" #IcmpCreateFile
dll- "%icmp_dll%" #IcmpCloseHandle IcmpHandle
dll- "%icmp_dll%" #IcmpSendEcho2 IcmpHandle Event ApcRoutine !*ApcContext #DestinationAddress !*RequestData @RequestSize IP_OPTION_INFORMATION*RequestOptions !*ReplyBuffer ReplySize Timeout

int ipa=inet_addr(dest)
if(ipa=INADDR_NONE)
,if(!GetIpAddress(dest _s)) ret
,ipa=inet_addr(_s)

str sd.RandomString(32 32)
str rb.all(8*sizeof(ICMP_ECHO_REPLY)+sd.len 2 0)
ICMP_ECHO_REPLY& r=rb

;------------------
;!!rem
;workaround to QM version < 2.3.0.8 bug: possible random exceptions when delayloading dll functions from multiple threads simultaneously
lock
_i=&IcmpCreateFile+&IcmpCloseHandle+&IcmpSendEcho2
lock-
;------------------

int h=IcmpCreateFile

if(IcmpSendEcho2(h 0 0 0 ipa sd sd.len 0 rb rb.len iif(timeout timeout 1000)) and (!r.Status or r.Status=11000))
,int t=r.RoundTripTime; if(!t) t=1
,if(&TTL) TTL=r.Options.Ttl

IcmpCloseHandle h

ret t

Tested on Vista and XP. Should also work on 2000.
#9
Amazing.

Thanks for all.

Now, only need to create the QM Dialog to become FREEping.

note: works in W2000.
#10
Is possible create QM dialog with colours like http://www.kwakkelflap.com/pingsample.html?
#11
SysListView32 control can have different colors or rows, but don't know how about cells. Or can try to draw in ownerdraw ListBox. Quite difficult. Maybe on the internet you can find a list or grid control that supports cell colors.
#12
http://www.codeproject.com/KB/miscctrl/gridctrl.aspx

or

http://cpansearch.perl.org/src/ROBERTMA ... idCtrl.cpp

?
#13
QM cannot use C++ classes. Need ActiveX or dll.
#14
scgrid supports cell colors.
Function DlgSCGrid
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

typelib prjSCGrid {28FDFE2B-68C4-11D4-92BF-8364E6807441} 13.8
;typelib prjSCGrid {BDE7D104-7E95-11D4-B68F-D74C9D5E7B57} 4.1

if(!ShowDialog("DlgSCGrid" &DlgSCGrid 0)) ret

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ActiveX 0x54000000 0x0 8 8 176 82 "prjSCGrid.SCGrid"
;END DIALOG
;DIALOG EDITOR: "" 0x2010700 "*" ""

ret
;messages
sel message
,case WM_INITDIALOG
,prjSCGrid.SCGrid sc3._getcontrol(id(3 hDlg))
,;sc3._setevents("sc3___SCGrid")
,
,sc3.CaptionEnabled=-1
,sc3.Text(0 0)="A"
,sc3.Text(0 1)="B"

,;stdole.StdFont f._create
,;f.Name="Courier New"
,;f.Underline=-1
,;sc3.Font=f

,ARRAY(VARIANT) a.create(2 2)
,a[0 0]="a"; a[1 0]="b" ;;first row
,a[0 1]="c"; a[1 1]="d"
,sc3.LoadFromArray(a -1)
,sc3.RowMode(2)=3 ;;editable
,
,sc3.CellBackColor(1 1)=0xffff
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#15
ActiveX version of MFC Grid Control. It uses some older version of the MFC control.
http://www.codeproject.com/KB/atl/gridctrl_atl.aspx

Function AX_AtlNewGrid
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
typelib ATLNEWGRIDLib {1A6B8660-58C4-11D3-B221-006097FEBF00} 1.0

if(!ShowDialog("AX_AtlNewGrid" &AX_AtlNewGrid)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ActiveX 0x54030000 0x0 0 0 224 112 "ATLNEWGRIDLib.Grid"
;END DIALOG
;DIALOG EDITOR: "" 0x2020008 "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,ATLNEWGRIDLib.Grid gr3._getcontrol(id(3 hDlg))
,
,gr3.RowCount=8
,gr3.ColumnCount=6
,int r c
,for r 0 gr3.RowCount
,,gr3.RowHeight(r)=16
,,for c 0 gr3.ColumnCount
,,,if(r)
,,,,if(c) _s.from(" " r-1); _s[0]='A'+c-1
,,,,else _s=r-1
,,,else if(c) _s=" "; _s[0]='A'+c-1
,,,gr3.Text(r c)=_s
,,,if(r and c) gr3.CellBgColor(r c)=ColorAdjustLuma(RandomInt(0 0xffffff) 500 1)
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,gr3._getcontrol(id(3 hDlg))
,ATLNEWGRIDLib.IGridCell ce=gr3.Cell(2 1)
,out ce.Text
,case IDCANCEL
ret 1

with icons
Function AX_AtlNewGrid
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
typelib ATLNEWGRIDLib {1A6B8660-58C4-11D3-B221-006097FEBF00} 1.0

if(!ShowDialog("AX_AtlNewGrid" &AX_AtlNewGrid)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 ActiveX 0x54030000 0x0 0 0 224 112 "ATLNEWGRIDLib.Grid"
;END DIALOG
;DIALOG EDITOR: "" 0x2020008 "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,ATLNEWGRIDLib.Grid gr3._getcontrol(id(3 hDlg))
,
,stdole.IPictureDisp p1 p2
,_s.expandpath("$qm$\copy.ico")
,;_s.expandpath("$qm$\bitmap1.bmp") ;;works too
,OleLoadPictureFile(_s &p1)
,_s.expandpath("$qm$\email.ico")
,OleLoadPictureFile(_s &p2) ;;why does not load some icons?
,;out p2
,
,gr3.RowCount=8
,gr3.ColumnCount=6
,int r c; str s
,for r 0 gr3.RowCount
,,gr3.RowHeight(r)=16
,,for c 0 gr3.ColumnCount
,,,if(r)
,,,,if(c) s.from(" " r-1); s[0]='A'+c-1
,,,,else s=r-1
,,,else if(c) s=" "; s[0]='A'+c-1
,,,else s=""
,,,gr3.Text(r c)=s
,,,if(r and c) gr3.CellBgColor(r c)=ColorAdjustLuma(RandomInt(0 0xffffff) 500 1)
,,
,,if(r)
,,,gr3.Image(r 0)=5 ;;this works, but the imagelist is built into the control and cannot be changed without recompiling the control
,,,;gr3.Cell(r 0).Picture=+p1 ;;does not work
,,,gr3.Cell(r 1).Picture=+p1 ;;works
,,,gr3.Cell(r 2).Picture=+p2 ;;works
,
,for c 0 gr3.ColumnCount
,,gr3.ColumnWidth(c)=50
,,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,gr3._getcontrol(id(3 hDlg))
,ATLNEWGRIDLib.IGridCell ce=gr3.Cell(2 1)
,out ce.Text
,case IDCANCEL
ret 1
#16
How can I set in a cell the ping result every second in prjSCGrid or ATLNEWGRIDLib?
#17
Function dlg_multiping
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

typelib prjSCGrid {28FDFE2B-68C4-11D4-92BF-8364E6807441} 13.8

;------------------------
;Create sample file containing list of IPs and/or web servers and/or network computer names
;Remove this code if not needed.
str pl="$my qm$\ping list.txt"
if(!dir(pl))
,str spl=
;;SAMPLE LIST
;
;;web servers
;www.quickmacros.com
;www.google.com
;www.download.com
;
;;IP
;255.255.255.255
;84.32.123.1
,if(!dir("$my qm$" 1)) mkdir "$my qm$"
,spl.setfile(pl)
;------------------------

str controls = "7"
str e7
e7=5
if(!ShowDialog("dlg_multiping" &dlg_multiping &controls)) ret

;BEGIN DIALOG
;0 "" 0x10CF0A40 0x100 0 0 224 231 "QM Multi Ping"
;8 Button 0x54032000 0x0 0 0 40 14 "Start"
;9 Button 0x54032000 0x0 40 0 40 14 "Stop"
;6 Static 0x54000000 0x0 86 2 24 10 "Period"
;7 Edit 0x54032000 0x200 110 0 28 14 ""
;5 Button 0x54032000 0x0 144 0 40 14 "List"
;4 Button 0x54032000 0x0 184 0 40 14 "Help"
;3 ActiveX 0x54000000 0x0 0 16 216 188 "prjSCGrid.SCGrid"
;END DIALOG
;DIALOG EDITOR: "" 0x2030008 "*" "" ""

ret
;messages
int+ __multiping_started

sel message
,case WM_INITDIALOG
,EnableWindow(id(9 hDlg) 0)

;In QM, scgrid does not work well:
;;;;1. Cells are not displayed until LoadFromArray.
;;;;2. Fails to create control after RT error. Restart QM.

,prjSCGrid.SCGrid gridping
,gridping._getcontrol(id(3 hDlg))
,;gridping._setevents("gridping___SCGrid")
,
,gridping.DefaultHeight=18
,ARRAY(VARIANT) _a.create(1 1); gridping.LoadFromArray(_a -1); gridping.ResetGrid
,gridping.Cols=3
,gridping.RowBackColor(0)=0xe0c0c0
,gridping.RowStyle(0)=2
,gridping.Text(0 1)="time"
,gridping.Text(0 2)="TTL"
,
,dlg_multiping_load hDlg
,
,goto size
,
,case WM_DESTROY
,__multiping_started=0
,
,case WM_SIZE
,;size
,RECT rc rb
,GetClientRect(hDlg &rc)
,GetWindowRect(id(8 hDlg) &rb)
,int gtop=rb.bottom-rb.top+2
,MoveWindow id(3 hDlg) 0 gtop rc.right rc.bottom-gtop 1
,gridping._getcontrol(id(3 hDlg))
,GetClientRect(id(3 hDlg) &rc)
,gridping.ColWidth(0)=rc.right-gridping.ColWidth(1)-gridping.ColWidth(2)
,
,case WM_COMMAND goto messages2
,
,case WM_APP ;;from dlg_multiping_thread
,gridping._getcontrol(id(3 hDlg))
,gridping.RowBackColor(wParam)=iif(lParam 0xffffff 0xffff); err ret
,str t(lParam&0xffff) ttl(lParam>>16)
,gridping.Text(wParam 1)=iif(lParam t "")
,gridping.Text(wParam 2)=iif(lParam ttl "")
,
ret
;messages2
sel wParam
,case 8 ;;Start
,__multiping_started=1
,EnableWindow(id(8 hDlg) 0)
,EnableWindow(id(9 hDlg) 1)
,if(!dlg_multiping_load(hDlg 1)) goto stop
,
,case 9 ;;Stop
,;stop
,__multiping_started=0
,EnableWindow(id(8 hDlg) 1)
,EnableWindow(id(9 hDlg) 0)
,
,case 5 ;;List
,run "$my qm$\ping list.txt"; err
,
,case 4 ;;Help
,str sh=
;Pings multiple computers on the internet or local network.
;Displays roundtrip time in milliseconds and TTL.
;If a computer is inaccessible, the line is yellow.
;
;List of computers must be in "%s".
;A computer can be specified by IP (eg 123.45.67.89), or web server (www.xxx.com), or network computer name.
;Lines starting with space or semicolon are ignored. Also empty lines.
;If the file does not exist, creates sample file.
;You can edit the file in notepad.
;If started, after editing list or period press Stop and Start.
;
;Creates thread for each computer. Don't monitor too many computers. 100 is OK.
,mes sh "" "" pl.expandpath("$my qm$\ping list.txt")
,
,case IDOK
,case IDCANCEL
ret 1

Function dlg_multiping_load
Code:
Copy      Help
;/
function! hDlg [flags] ;;flags: 1 launch

prjSCGrid.SCGrid gridping._getcontrol(id(3 hDlg))
gridping.Rows=1

str spl.getfile("$my qm$\ping list.txt"); err ret

ARRAY(str) a=spl
int i
for(i a.len-1 -1 -1) if(!a[i].len or a[i][0]=32 or a[i][0]=';') a.remove(i)
if(!a.len) ret

int per=val(_s.getwintext(id(7 hDlg))); if(per<1) per=1

gridping.Rows=2; gridping.RowBackColor(1)=0xffffff; gridping.RowStyle(1)=0 ;;other rows inherit style of current last row
gridping.Rows=a.len+1
for i 0 a.len
,gridping.Text(i+1 0)=a[i]
,if(flags&1) mac "dlg_multiping_thread" "" hDlg i+1 a[i] per

ret 1

Function dlg_multiping_thread
Code:
Copy      Help
;\
function hDlg row $dest period

rep
,int t ttl
,rep 3
,,if(!__multiping_started) ret
,,t=Ping(dest ttl)
,,if(t) break
,,0.3
,if(!t) ttl=0
,SendMessage hDlg WM_APP row ttl<<16|t
,rep(period) 1; if(!__multiping_started) ret
#18
Incredible!

This is what I was looking for.

Note: the scrollbars don't work.
#19
On Vista scrollbars OK.
#20
I tested it in W2000 and Wxp and scrollbars don't work maybe it is due to the version of SCGrid (13.2).

I think that it would be better use SysListView32 to avoid depending of external libraries.
#21
with listview

Function dlg_multiping
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;------------------------
;Create sample file containing list of IPs and/or web servers and/or network computer names
;Remove this code if not needed.
str pl="$my qm$\ping list.txt"
if(!dir(pl))
,str spl=
;;SAMPLE LIST
;
;;web servers
;www.quickmacros.com
;www.google.com
;www.download.com
;
;;IP
;255.255.255.255
;84.32.123.1
,if(!dir("$my qm$" 1)) mkdir "$my qm$"
,spl.setfile(pl)
;------------------------

str controls = "7"
str e7
e7=5
if(!ShowDialog("dlg_multiping" &dlg_multiping &controls)) ret

;BEGIN DIALOG
;0 "" 0x10CF0A40 0x100 0 0 224 224 "QM Multi Ping"
;8 Button 0x54032000 0x0 0 0 40 14 "Start"
;9 Button 0x54032000 0x0 40 0 40 14 "Stop"
;6 Static 0x54000000 0x0 86 2 24 10 "Period"
;7 Edit 0x54032000 0x200 110 0 28 14 ""
;5 Button 0x54032000 0x0 144 0 40 14 "List"
;4 Button 0x54032000 0x0 184 0 40 14 "Help"
;3 SysListView32 0x54000049 0x0 0 16 216 188 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030008 "*" "" ""

ret
;messages
int+ __multiping_started
int hlv

sel message
,case WM_INITDIALOG
,EnableWindow(id(9 hDlg) 0)
,
,hlv=id(3 hDlg)
,int es=LVS_EX_FULLROWSELECT|LVS_EX_INFOTIP|LVS_EX_GRIDLINES
,SendMessage hlv LVM_SETEXTENDEDLISTVIEWSTYLE es es
,TO_LvAddCol hlv 0 "" 150
,TO_LvAddCol hlv 1 "Time" 50
,TO_LvAddCol hlv 2 "TTL" 50
,
,dlg_multiping_load hDlg
,goto size
,
,case WM_DESTROY
,__multiping_started=0
,
,case WM_SIZE
,;size
,RECT rc rb
,GetClientRect(hDlg &rc)
,GetWindowRect(id(8 hDlg) &rb)
,int gtop=rb.bottom-rb.top+2
,hlv=id(3 hDlg)
,MoveWindow hlv 0 gtop rc.right rc.bottom-gtop 1
,GetClientRect(hlv &rc)
,SendMessage hlv LVM_SETCOLUMNWIDTH 0 rc.right-100
,
,case WM_COMMAND goto messages2
,case WM_NOTIFY goto messages3
,
,case WM_APP ;;from dlg_multiping_thread
,hlv=id(3 hDlg)
,LVITEM li lip
,lip.mask=LVIF_PARAM; lip.lParam=!lParam; lip.iItem=wParam; SendMessage hlv LVM_SETITEM 0 &lip
,str t(lParam&0xffff) ttl(lParam>>16)
,li.pszText=iif(lParam t ""); li.iSubItem=1; SendMessage hlv LVM_SETITEMTEXT wParam &li
,li.pszText=iif(lParam ttl ""); li.iSubItem=2; SendMessage hlv LVM_SETITEMTEXT wParam &li
,
ret
;messages2
sel wParam
,case 8 ;;Start
,__multiping_started=1
,EnableWindow(id(8 hDlg) 0)
,EnableWindow(id(9 hDlg) 1)
,if(!dlg_multiping_load(hDlg 1)) goto stop
,
,case 9 ;;Stop
,;stop
,__multiping_started=0
,EnableWindow(id(8 hDlg) 1)
,EnableWindow(id(9 hDlg) 0)
,
,case 5 ;;List
,run "$my qm$\ping list.txt"; err
,
,case 4 ;;Help
,str sh=
;Pings multiple computers on the internet or local network.
;Displays roundtrip time in milliseconds and TTL.
;If a computer is inaccessible, the line is yellow.
;
;List of computers must be in "%s".
;A computer can be specified by IP (eg 123.45.67.89), or web server (www.xxx.com), or network computer name.
;Lines starting with space or semicolon are ignored. Also empty lines.
;If the file does not exist, creates sample file.
;You can edit the file in notepad.
;If started, after editing list or period press Stop and Start.
;
;Creates thread for each computer. Don't monitor too many computers. 100 is OK.
,mes sh "" "" pl.expandpath("$my qm$\ping list.txt")
,
,case IDOK
,case IDCANCEL
ret 1
;messages3
NMHDR* nh=+lParam
sel nh.idFrom
,case 3 ;;list
,sel nh.code
,,case NM_CUSTOMDRAW
,,NMLVCUSTOMDRAW* cd=+nh
,,sel cd.nmcd.dwDrawStage
,,,case CDDS_PREPAINT ret DT_Ret(hDlg CDRF_NOTIFYITEMDRAW)
,,,case CDDS_ITEMPREPAINT
,,,cd.clrTextBk=iif(cd.nmcd.lItemlParam 0xffff iif(cd.nmcd.dwItemSpec&1 0xF8F8F8 0xFFFFFF))

Function dlg_multiping_load
Code:
Copy      Help
;/
function! hDlg [flags] ;;flags: 1 launch

int hlv=id(3 hDlg)
SendMessage hlv LVM_DELETEALLITEMS 0 0

str spl.getfile("$my qm$\ping list.txt"); err ret

ARRAY(str) a=spl
int i
for(i a.len-1 -1 -1) if(!a[i].len or a[i][0]=32 or a[i][0]=';') a.remove(i)
if(!a.len) ret

int per=val(_s.getwintext(id(7 hDlg))); if(per<1) per=1

for i 0 a.len
,TO_LvAdd hlv i 0 0 a[i]
,if(flags&1) mac "dlg_multiping_thread" "" hDlg i a[i] per

ret 1

Function dlg_multiping_thread
Code:
Copy      Help
;\
function hDlg row $dest period

rep
,int t ttl
,rep 3
,,if(!__multiping_started) ret
,,t=Ping(dest ttl)
,,if(t) break
,,0.3
,if(!t) ttl=0
,SendMessage hDlg WM_APP row ttl<<16|t
,rep(period) 1; if(!__multiping_started) ret
#22
Now, it works perfectly.

Thank you very much.
#23
Fixed Ping bugs:
Sometimes would return 1 even if failed.
Possible random exceptions.
#24
Is possible draw the ping of IP in QM dialog like http://lit999.narod.ru/soft/ping/index.html or otherwise?
#25
To draw such things, use function PolylineTo or other similar functions. Documented in MSDN.
#26
Function Dialog84
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("Dialog84" &Dialog84)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030106 "" "" ""

ret
;messages
__MemBmp- mb ;;memory device context
int- x
sel message
,case WM_INITDIALOG
,mb.Create(200 100)
,SetTimer hDlg 1 500 0
,
,case WM_TIMER
,sel wParam
,,case 1
,,;draw line to random y in memory DC
,,int y=RandomInt(0 99)
,,RECT r.right=200; r.bottom=100
,,if(x=0) ;;erase
,,,FillRect mb.dc &r GetStockObject(WHITE_BRUSH)
,,,MoveToEx mb.dc 0 y 0
,,int pen0=SelectObject(mb.dc CreatePen(PS_SOLID 1 0xc000)) ;;select green pen
,,LineTo mb.dc x y
,,DeleteObject SelectObject(mb.dc pen0)
,,x+8; if(x>=200) x=0
,,InvalidateRect hDlg &r 0 ;;send WM_PAINT now
,
,case WM_PAINT
,;copy from memory DC to window DC
,PAINTSTRUCT ps
,BeginPaint hDlg &ps
,BitBlt ps.hDC 0 0 200 100 mb.dc 0 0 SRCCOPY
,EndPaint hDlg &ps
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#27
Amazing. Thanks.

I found http://msdn.microsoft.com/en-us/library ... 85%29.aspx . Is possible use in QM?
#28
What it is? Why in QM?
#29
I wondered if it was possible monitoring events or functions of QM like sysmon.
#30
No.


Forum Jump:


Users browsing this thread: 3 Guest(s)