Click here to Skip to main content
15,898,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Hardware list error Pin
David Crow23-Mar-05 9:47
David Crow23-Mar-05 9:47 
Put a breakpoint on the SetupDiCreateDeviceInfoList() statement and single-step through the code until you get to the statement that causes the error.

I cleaned up your code a bit to look like:

HDEVINFO DoDeviceEnum( void )
{
    GUID        InterfaceClassGuid;
    HDEVINFO    DeviceInfoSet,
                NewDeviceInfoSet;
 
    DeviceInfoSet = SetupDiCreateDeviceInfoList(&InterfaceClassGuid, NULL);
    if (DeviceInfoSet != INVALID_HANDLE_VALUE) 
    {
        NewDeviceInfoSet = SetupDiGetClassDevsEx(&InterfaceClassGuid, 
                                                 NULL, 
                                                 NULL, 
                                                 DIGCF_PRESENT | DIGCF_DEVICEINTERFACE, 
                                                 DeviceInfoSet, 
                                                 NULL,
                                                 NULL);
 
        if (NewDeviceInfoSet != INVALID_HANDLE_VALUE) 
            ; // do something with the list
        else
            printf("SetupDiGetClassDevsEx failed: %lu.\n", GetLastError());
 
        SetupDiDestroyDeviceInfoList(DeviceInfoSet);
    }
    else
        printf("SetupDiCreateDeviceInfoList failed: %lu.\n", GetLastError());
 
    return NewDeviceInfoSet;
}
 
void main( void )
{
    DoDeviceEnum();
}



"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralSocket programming Pin
vinsankar23-Mar-05 6:55
vinsankar23-Mar-05 6:55 
GeneralRe: Socket programming Pin
greba23-Mar-05 7:44
greba23-Mar-05 7:44 
GeneralRe: Socket programming Pin
vinsankar23-Mar-05 21:44
vinsankar23-Mar-05 21:44 
GeneralHelp me debug MFC app that uses COM Pin
Budric B.23-Mar-05 6:18
Budric B.23-Mar-05 6:18 
GeneralCString class Pin
ddmcr23-Mar-05 6:13
ddmcr23-Mar-05 6:13 
GeneralRe: CString class Pin
Budric B.23-Mar-05 6:32
Budric B.23-Mar-05 6:32 
GeneralRe: CString class Pin
David Crow23-Mar-05 7:56
David Crow23-Mar-05 7:56 
GeneralRe: CString class Pin
toxcct23-Mar-05 8:37
toxcct23-Mar-05 8:37 
GeneralRe: CString class Pin
Michael Dunn23-Mar-05 14:23
sitebuilderMichael Dunn23-Mar-05 14:23 
GeneralEvents in MFC... Pin
anderslundsgard23-Mar-05 5:06
anderslundsgard23-Mar-05 5:06 
GeneralRe: Events in MFC... Pin
David Crow23-Mar-05 5:39
David Crow23-Mar-05 5:39 
GeneralRe: Events in MFC... Pin
anderslundsgard23-Mar-05 7:51
anderslundsgard23-Mar-05 7:51 
GeneralRe: Events in MFC... Pin
David Crow23-Mar-05 7:54
David Crow23-Mar-05 7:54 
GeneralRe: Events in MFC... Pin
Maximilien23-Mar-05 8:10
Maximilien23-Mar-05 8:10 
GeneralRe: Events in MFC... Pin
anderslundsgard23-Mar-05 9:39
anderslundsgard23-Mar-05 9:39 
GeneralRe: Events in MFC... Pin
PJ Arends23-Mar-05 11:03
professionalPJ Arends23-Mar-05 11:03 
GeneralRe: Events in MFC... Pin
anderslundsgard25-Mar-05 4:55
anderslundsgard25-Mar-05 4:55 
GeneralPrinting in MFC Pin
Ziggy Short23-Mar-05 4:20
Ziggy Short23-Mar-05 4:20 
GeneralRe: Printing in MFC Pin
David Crow23-Mar-05 5:35
David Crow23-Mar-05 5:35 
Generalcontext menus in visual studio 6 Pin
sumo6923-Mar-05 3:50
sumo6923-Mar-05 3:50 
GeneralRe: context menus in visual studio 6 Pin
YaronNir23-Mar-05 4:31
YaronNir23-Mar-05 4:31 
GeneralRe: context menus in visual studio 6 Pin
sumo6923-Mar-05 5:24
sumo6923-Mar-05 5:24 
GeneralInno setup question Pin
YaronNir23-Mar-05 3:46
YaronNir23-Mar-05 3:46 
GeneralRe: Inno setup question Pin
JohnJ23-Mar-05 4:26
JohnJ23-Mar-05 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.