//
// This may take a while :^(
//
hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
//
// Get a handle to the Selected Item.
//
if (!SetupDiEnumDeviceInfo(hDevInfo,SelectedItem,&DeviceInfoData))
{
// printf("EnumDeviceInfo");
return FALSE;
}
//
// Set the PropChangeParams structure.
//
PropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
PropChangeParams.Scope = DICS_FLAG_GLOBAL;
PropChangeParams.StateChange = NewState;
int NetCtrl(DWORD state)
{
if (INVALID_HANDLE_VALUE == (hDevInfo =
SetupDiGetClassDevs(NULL,NULL,0,
DIGCF_PRESENT|DIGCF_ALLCLASSES)))
{
// printf("GetClassDevs");
return 1;
}
DWORD i, Status, Problem;
SP_DEVINFO_DATA DeviceInfoData = {sizeof(SP_DEVINFO_DATA)};
HKEY hKeyClass;
char DeviceName[200];
for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,&DeviceInfoData);i++)
{
if (IsClassNet(&DeviceInfoData.ClassGuid))
{
//printf(" the class's index is %d\n",i);
//
//DICS_DISABLE-->禁用网络
//DICS_ENABLE--->恢复网络
//
if (StateChange(state,i,hDevInfo))