Article View: borland.public.cppbuilder.nativeapi
Article #12959Re: LAN Connection Status
From: vERUs
Date: Mon, 10 Nov 2003 16:17
Date: Mon, 10 Nov 2003 16:17
37 lines
1854 bytes
1854 bytes
You'll need to add the iphlpapi.lib to your project.
#include <iphlpapi.h>
PMIB_IFTABLE IFTable;
MIB_IFROW MibRow;
ULONG Sz = 0;
DWORD Result = GetIfTable(NULL, &Sz, false);
IFTable = (PMIB_IFTABLE)GlobalAlloc(GPTR, Sz);
Result = GetIfTable(IFTable, &Sz, true);
if (Result == NO_ERROR)
{
for (unsigned int i = 0; i < IFTable->dwNumEntries; i++)
{
MibRow = IFTable->table[i];
if (MibRow.dwType != MIB_IF_TYPE_LOOPBACK && MibRow.dwType !=
MIB_IF_TYPE_OTHER)
{
// Read whatever value you want from the MIB_IFROW structure
}
}
// Avallokera minne
GlobalFree((HGLOBAL)IFTable);
}
For a description of MIB_IFROW:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rras/rras/m
ib_ifrow.asp
// vERUs
Technical Details
Message-ID:
<3fafba2a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3faaa223$1@newsgroups.borland.com> <3faac95e$1@newsgroups.borland.com> <3fabf8ce$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,f495dab9d8b0e06e X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-10 08:40:11 PST From: "vERUs" <-verus-@telia.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3faaa223$1@newsgroups.borland.com> <3faac95e$1@newsgroups.borland.com> <3fabf8ce$1@newsgroups.borland.com> Subject: Re: LAN Connection Status Date: Mon, 10 Nov 2003 17:17:00 +0100 Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 NNTP-Posting-Host: 217.210.229.131 Message-ID: <3fafba2a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068481066 217.210.229.131 (10 Nov 2003 08:17:46 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail