#include <windows.h>
#include <iphlpapi.h>
#include <objbase.h>
#include <netcon.h>
#include <stdio.h>
.....
void disableNIC(char * AdapterName)
{
INetConnectionManager* pNet;
INetConnection* pConn;
IEnumNetConnection* pEnum;
NETCON_PROPERTIES* pProps;
wchar_t Temp[255];
ULONG uCount = 0;
swprintf(Temp, L"%S", AdapterName);
CoInitialize(NULL);
CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, IID_INetConnectionManager, (void**)&pNet);
//CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, __uuidof(INetConnectionManager), (void**)&pNet);
pNet->EnumConnections(NCME_DEFAULT, &pEnum);
....
...
}
#include <windows.h>
#include <iphlpapi.h>
#include <objbase.h>
#include <netcon.h>
#include <stdio.h>
.....
void disableNIC(char * AdapterName)
{
INetConnectionManager* pNet;
INetConnection* pConn;
IEnumNetConnection* pEnum;
NETCON_PROPERTIES* pProps;
wchar_t Temp[255];
ULONG uCount = 0;
swprintf(Temp, L"%S", AdapterName);
CoInitialize(NULL);
CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, IID_INetConnectionManager, (void**)&pNet);
//CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, __uuidof(INetConnectionManager), (void**)&pNet);
pNet->EnumConnections(NCME_DEFAULT, &pEnum);
....
...
}
To copy to clipboard, switch view to plain text mode
it has an error with "undefined referenced to CLSID_ConnectionManager" and "IID_INetConnectionManager",or _uuidof was not declared in this scope.
Bookmarks