Ping with VB the Easiest Way Using IPHLP.API

Category:
Network/Internet
Type:
Snippets
Difficulty:
Intermediate
Author:
Light_Templer

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:

Adapted from a small article from Bill Nolde on CodeGuru. He used the GetRTTAndHopCount function in C to do a simple ping. Great idea, works fine. It takes an IP address as string, and returns Boolean if the address was reached.

From C to VB is only a small step, I thought. Two simple API calls wrapped in a small function are enough to check for a unit.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: