

You have to instantiate an object instance that implements that interface, and then call the member method on that object. GetNetworkConnections is not a static method, so it can't be called directly from the interface. So it gets a whole lot more complicated than just calling this single function. Sure enough, this is actually a COM API, provided by the INetworkListManager interface.

But uh-oh, I just mentioned COM in that last paragraph. That's how you call the GetNetworkConnections function. You can use the SUCCEEDED macro to test whether the function call was successful. The function returns an HRESULT value, which is a common way that COM functions indicate success or failure. You call it by declaring a pointer variable of the correct type, and then passing the address of that variable into the function. Pointer to a pointer that receives an IEnumNetworkConnections interface instance that enumerates all network connections on the machine. So you end up with double pointers, because you're modifying a pointer.Īgain, the documentation gives you a clue as to how it works when it describes the parameters: The function is going to modify a pointer variable, and the only way that it can modify something is for it to work on a pointer to that object. I assume you know the C++ language well enough to know what that means. The prototype for the function given in the documentation indicates that it accepts a single parameter that is a pointer to a pointer: HRESULT STDMETHODCALLTYPE GetNetworkConnections( System headers (like windows.h) are included using angle brackets, like so: #include Headers in your project are included with quotation marks around the name of the header, like so: #include "stdafx.h" System headers are included using a different syntax than headers in your project.
INETWORK APPS CODE
First things first! Your sample code is already wrong.
