1

Is there a way to detect the internet connection on Windows in C/C++?

I've tried playing around with the connection types in Windows.h, but I haven't figured out a good way.

Just to clarify I don't mean sending an HTTP request to google. I mean getting the actual status of Windows' connection to a network. Windows clearly has that info because they display it in the taskbar, so I'm wondering if I can access that as well.

Juliette
  • 23
  • 4
  • @DanielA.White the third answer does. The first one tries to access Google which is a problem because a lot of people are unable to access Google. The second one is deprecated, but the third one works. Thank you – Juliette Jul 17 '22 at 22:47
  • 3
    I recommend upvoting [the answer](https://stackoverflow.com/a/61469972/1553090) that uses `INetworkListManager` to help it gain visibility. This is the approach recommended by Raymond Chen also ([old new thing post](https://devblogs.microsoft.com/oldnewthing/20201102-00/?p=104411)) – paddy Jul 17 '22 at 22:52

0 Answers0