|
-
Feb 17th, 2010, 10:33 AM
#1
Thread Starter
Lively Member
how to ping via vb6.?
i will sent ping via vb6.0 but not shell command
need what API for ping ? (example code)
somebody help me plzzz
thank you
-
Feb 17th, 2010, 10:43 AM
#2
Re: how to ping via vb6.?
I'm not going to write all the code for this as it is verly clearly written already here:
IcmpSendEcho: Ping a Machine by IP Address
and here:
IcmpSendEcho: Ping a Machine by Host Name
It's sample is using 11 APIs but I'm pretty sure if you look at the code and only take what you need for yourself it will be shorter.
Good Luck
Kind Regards,
Optional
If you feel this post has helped in answering your question please return the favour and Rate this post.
If your problem has been solved and your question has been answered mark the thread as [RESOLVED] by selecting the Thread Tools menu option at the top and clicking the Mark Thread Resolved menu item.
VB6 - (DataGrid) Get the Row selected with the right mouse button
-
Feb 17th, 2010, 10:45 AM
#3
Re: how to ping via vb6.?
You can ping using the IPHLP API... Let me create an example for you....
here it is
Code:
Private Declare Function GetRTTAndHopCount Lib "iphlpapi.dll" _
(ByVal lDestIPAddr As Long, ByRef lHopCount As Long, _
ByVal lMaxHops As Long, ByRef lRTT As Long) As Long
Private Declare Function inet_addr Lib "wsock32.dll" _
(ByVal cp As String) As Long
Private Sub Command1_Click()
MsgBox PingIP("xxx.xxx.xxx.xxx")
End Sub
Public Function PingIP(sIPadr As String) As Boolean
Dim lIPadr As Long, lHopsCount As Long, lRTT As Long, lMaxHops As Long, lResult As Long
Const SUCCESS = 1
lMaxHops = 20
lIPadr = inet_addr(sIPadr)
PingIP = (GetRTTAndHopCount(lIPadr, lHopsCount, lMaxHops, lRTT) = SUCCESS)
End Function
Last edited by Siddharth Rout; Feb 17th, 2010 at 10:52 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 17th, 2010, 10:54 AM
#4
Re: how to ping via vb6.?
Nice one koolsid, using that is short and sweet 
I tried to checkout a sample and came across an article implying a memory leak issue when using that API in C (see link for reference):
Memory leakage in Iphlpapi-Function GetRTTAndHopCount ?
To quote from the link:
I've rewritten it without MFC (which I find totally annoying), and there
seems to be a real leak in the call, yes. I'd say it's a bug to be reported
to product support services. I think I'm totally up-to-date with all the OS
QFEs, so this would require a new one. By the way, the leak is not always
8k. During the first five or six passes, the leak is sometimes 4k,
sometimes nothing, and sometimes 8k. After it's run for a while, it seems
to stabilize on 8k, though.
I'm don't know if this is an issue too when using it from VB6, also this was a few years ago. Anyone know if it is an issue ?
Kind Regards,
Optional
If you feel this post has helped in answering your question please return the favour and Rate this post.
If your problem has been solved and your question has been answered mark the thread as [RESOLVED] by selecting the Thread Tools menu option at the top and clicking the Mark Thread Resolved menu item.
VB6 - (DataGrid) Get the Row selected with the right mouse button
-
Feb 17th, 2010, 11:11 AM
#5
Re: how to ping via vb6.?
I won't be able to test it right now as I am in the office but if someone can test it using this...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Feb 17th, 2010, 12:13 PM
#6
Thread Starter
Lively Member
Re: how to ping via vb6.?
-
Feb 17th, 2010, 12:37 PM
#7
Re: how to ping via vb6.?
if your query is solved then do remember to mark this thread resolved
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|