SHARE
Facebook X Pinterest WhatsApp

An ATL project to run PING and TRACERT

Download Source Code and Example The Icmpcom project is a basic ALT template created by the ATL wizard. The control acts as an interface to the ICMP.DLL . This DLL is supplied by MS to allow PING and TRACERTs to be run under a dos window. The Control can be used by a VB5 app […]

Written By
thumbnail
CodeGuru Staff
CodeGuru Staff
Apr 12, 2001
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Download Source Code and Example

The Icmpcom project is a basic ALT template created by the ATL wizard.
The control acts as an interface to the ICMP.DLL . This DLL is supplied by MS to allow
PING and TRACERTs to be run under a dos window.

The Control can be used by a VB5 app to create a nice list box and series of
button and edit boxes to provide a user interface to PING and TRACERT.

ICMP.DLL is impleted via a Thread which is started when the StartPing method is
called. The thread continues to run till the operation finishes or is canceled via
a StopPing call. Tracert is implemented automatically when a StartPing request
is issued and the tracert option in the parmlist is TRUE.

The Methods should be invoked in the following order. SetPingVariables and RunPing
can be called as a request is needed. When the app terminates be sure to call
StopPing.



















StartICMP

Must be the first call made to the control.
Loads and initializes the DLL returns an
error message thru the event sink if failed

SetPingVariables()

Just That. It accepts most all of the options
accepted by the Dos Ping. It can support
all of them if you want to code them up.

RunPing()


We can finally issue a ping request.

StopPing()

tries to cancel the operation that is in
progress

StopICMP

Last call to the control. Unloads the DLL
and cleans up Winsock

The Events will call into the container under 3 possible conditions.

  1. When the Ping/Tracert request wants to send back a reply.

  2. When the Ping/Tracert request is completed

  3. When StopICMP is called.










PingMsgEvent(BSTR)


Passes back the data returned from the
request. The data is pre formatted and ready
to display.


PingDoneEvent()


After each PING request is completed


PingTerminated()


After StopICMP is called

The sample VB and MSVC++ app demonstrates how icmpcom works.

The VC++ container was a little more work than VB. The Event Sinks
had to be added by creating a new class in class wizard based from
CcmdTarget. The functions (sink events) had to be added to the
CPP and H files manually after the class was created. Note the
BEGIN_DISPATCH_MAP() section in the cpp file.

Reference materials.

Beginning ATL COM programming Wrox Press http://www.wrox.com

Active/X COM control programming Wrox Press http://www.wrox.com

The ATL samples from Visual C++ 5.0

The WorldOfATL http://www.worldofatl.com

MFC CodeGuru ATL Section https://www.codeguru.com

MSJ June 1998 http://www.microsoft.com/msj

Last updated: 22 June 1998

Recommended for you...

Introduction to Web Components API
Tariq Siddiqui
Jul 13, 2022
From SOAP to REST to GraphQL: API Deep Dive
Joydip Kanjilal
Jun 14, 2022
Implement Swagger In ASP.NET Web API
Tapas Pal
Nov 14, 2021
Why Should I Move to the Cloud?
Zaher Talab
Oct 15, 2021
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.