SetDICreateDeviceInfoList()
-
it is a program of MSDN , which i have written in console win32 application because in win32 applicaiton it was also giving problems.It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters....Plz help me out #include #include #include DWORD Err; HDEVINFO DoDeviceEnum( GUID InterfaceClassGuid) /* Routine Description: Retrieves the device information set that contains that contains the devices of the specified class. Parameters: InterfaceClassGuid - The interface class GUID. Return Value: If the function succeeds, the return value is a handle to the device information set. If the function fails, the return value is zero. */ { HDEVINFO DeviceInfoSet; HDEVINFO NewDeviceInfoSet; // Create a device information set that will be the container for // the device interfaces. DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL); if(DeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiCreateDeviceInfoList failed: %lx.\n", Err ); return 0; } // Retrieve the device information set for the interface class. NewDeviceInfoSet=SetupDiGetClassDevsEx( InterfaceClassGuid,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,DeviceInfoSet,NULL,NULL); if(NewDeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiGetClassDevsEx failed: %lx.\n", Err ); return 0; } return NewDeviceInfoSet; } int main(int argc, TCHAR* argv[]) { DoDeviceEnum(NULL); return 0; }
-
it is a program of MSDN , which i have written in console win32 application because in win32 applicaiton it was also giving problems.It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters....Plz help me out #include #include #include DWORD Err; HDEVINFO DoDeviceEnum( GUID InterfaceClassGuid) /* Routine Description: Retrieves the device information set that contains that contains the devices of the specified class. Parameters: InterfaceClassGuid - The interface class GUID. Return Value: If the function succeeds, the return value is a handle to the device information set. If the function fails, the return value is zero. */ { HDEVINFO DeviceInfoSet; HDEVINFO NewDeviceInfoSet; // Create a device information set that will be the container for // the device interfaces. DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL); if(DeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiCreateDeviceInfoList failed: %lx.\n", Err ); return 0; } // Retrieve the device information set for the interface class. NewDeviceInfoSet=SetupDiGetClassDevsEx( InterfaceClassGuid,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,DeviceInfoSet,NULL,NULL); if(NewDeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiGetClassDevsEx failed: %lx.\n", Err ); return 0; } return NewDeviceInfoSet; } int main(int argc, TCHAR* argv[]) { DoDeviceEnum(NULL); return 0; }
i have included windows.h, stdio.h, setupapi.h
-
it is a program of MSDN , which i have written in console win32 application because in win32 applicaiton it was also giving problems.It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters....Plz help me out #include #include #include DWORD Err; HDEVINFO DoDeviceEnum( GUID InterfaceClassGuid) /* Routine Description: Retrieves the device information set that contains that contains the devices of the specified class. Parameters: InterfaceClassGuid - The interface class GUID. Return Value: If the function succeeds, the return value is a handle to the device information set. If the function fails, the return value is zero. */ { HDEVINFO DeviceInfoSet; HDEVINFO NewDeviceInfoSet; // Create a device information set that will be the container for // the device interfaces. DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL); if(DeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiCreateDeviceInfoList failed: %lx.\n", Err ); return 0; } // Retrieve the device information set for the interface class. NewDeviceInfoSet=SetupDiGetClassDevsEx( InterfaceClassGuid,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,DeviceInfoSet,NULL,NULL); if(NewDeviceInfoSet == INVALID_HANDLE_VALUE) { Err = GetLastError(); printf( "SetupDiGetClassDevsEx failed: %lx.\n", Err ); return 0; } return NewDeviceInfoSet; } int main(int argc, TCHAR* argv[]) { DoDeviceEnum(NULL); return 0; }
brilliant101 wrote: It gives an error that SetDICreateDeviceInfoList() does not take 7 parameters.... Right, it only takes two, which is what you have.
SetupDiGetClassDevsEx()
does take seven parameters, however, which you also have. Please provide the error verbatim from the compiler. Unless you are just looking for something extra to do, there is no reason to respond to all of your posts with the name of the header files that have been included. Using < and > correctly will suffice.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow