?
Solved

IP: Detecting the Default Gateway

Posted on 2000-03-02
7
Medium Priority
?
188 Views
Last Modified: 2010-04-02
How can I (programmatically) detect what my default gateway is?
0
Comment
Question by:jhattingh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:KangaRoo
ID: 2576611
Mh, found some IP info behind:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans
0
 
LVL 1

Author Comment

by:jhattingh
ID: 2576642
Thanks for responding.

I take it there isn't an API for this. In which case, I found that the DG is shown in

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{5A7F5924-5CC7-473D-B4C1-B683BA607D49}\Parameters\Tcpip

How would I programmatically retrieve or identify this key?
0
 
LVL 1

Author Comment

by:jhattingh
ID: 2576646
.. I don't mean how do I read the registry! I mean findin the GUID that identifies the correct key...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Expert Comment

by:KangaRoo
ID: 2576845
Aie, that key is not on my system :(

For using the registry, check the manuals (or win32.hlp)
Following are the functions used with the registry:

RegCloseKey
RegConnectRegistry
RegCreateKey
RegCreateKeyEx
RegDeleteKey
RegDeleteValue
RegEnumKey
RegEnumKeyEx
RegEnumValue
RegFlushKey
RegGetKeySecurity
RegLoadKey
RegNotifyChangeKeyValue
RegOpenKey
RegOpenKeyEx
RegQueryInfoKey
RegQueryMultipleValues
RegQueryValue
RegQueryValueEx
RegReplaceKey
RegRestoreKey
RegSaveKey
RegSetKeySecurity
RegSetValue
RegSetValueEx
RegUnLoadKey

The tool WinIpCfg uses RegOpenKey, RegQueryValueEx and RegCloseKey.
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 2576868
If you are running Win98 or Win2000, the IPHLPAPI.DLL offers the:

GetAdaptersInfo() function which will return the information you are looking for.

On Win95, you have to search the registry for the right network adapter and then find the gateway setting for that adapter.

On NT, it's the same process just a different registry tree.
0
 
LVL 1

Author Comment

by:jhattingh
ID: 2576893
Fantastic!
0
 
LVL 1

Author Comment

by:jhattingh
ID: 2576896
Thank you
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question