Hi,
Under control panel > Phone And Modem Options -> Modems tab, you can
see modems listed, such as USB modems, even if they are not attached.
When they are not attached, the "Attached To" column will show "Not
present".
I want to create such list myself, where it shows the description
(name) and modems, even if they are not attached.
I tried:
int _tmain(int argc, _TCHAR* argv[])
{
HWND hwndParent = NULL;
HDEVINFO hDevInfo;
SP_DEVINFO_DATA sdd;
sdd.cbSize = sizeof(SP_DEVINFO_DATA);
GUID guid;
if (RPC_S_OK != UuidFromString((RPC_WSTR)_T("4D36E96D-E325-11CE-
BFC1-08002BE10318"), &guid))
return -1;
hDevInfo = SetupDiGetClassDevs(
&guid,
NULL,
hwndParent,
DIGCF_PROFILE
);
if (INVALID_HANDLE_VALUE == hDevInfo)
return -1;
TCHAR szDeviceInstanceId[MAX_PATH];
DWORD i=0;
while(SetupDiEnumDeviceInfo(hDevInfo, i, &sdd)) {
if (SetupDiGetDeviceInstanceId(hDevInfo, &sdd, szDeviceInstanceId,
sizeof(szDeviceInstanceId)/sizeof(TCHAR), NULL)) {
// insert szDeviceInstanceId to a list
}
++i;
}
SetupDiDestroyDeviceInfoList(hDevInfo);
return 0;
}
However, when I uninstall the device, the above still lists its device
id (because the driver is still present, I think). And I don't want
this.
How can I list Unattached, BUT INSTALLED devices?
Lisa