Ravi shankar
Ravi shankar

Reputation: 2460

How to know the internet connection details using Visual C++ Win32 API

I have to create a log file for all internet connections made by PC. It should have details of the username, time of connection, etc. I do know about the InternetGetConnectedState() function which returns the boolean value. Know how do I get the other details. Can some one help me out thanks in advance. I am using Win32 API and Visual c++.

Upvotes: 8

Views: 2981

Answers (2)

Jerry Coffin
Jerry Coffin

Reputation: 490788

You can use RasEnumConnections to enumerate the current connections. You can then call RasGetLinkStatistics to get information about each link (connection speed, amount of data sent and/or received, time connected, etc.) If you want to know the address assigned to the client on a PPP connection, you have to retrieve that separately with RasGetProjectionInfo. If you want information about the connection (e.g. the name of the modem) you can retrieve that with RasGetConnectStatus.

Upvotes: 0

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99725

You could use Network List Manager API to get list of networks using IEnumNetworks. Then use INetwork interface to get network information.

Upvotes: 5

Related Questions