Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaldouble **abc Pin
TUMB21-Mar-05 7:59
TUMB21-Mar-05 7:59 
GeneralRe: double **abc Pin
David Crow21-Mar-05 8:36
David Crow21-Mar-05 8:36 
GeneralRe: double **abc Pin
toxcct21-Mar-05 22:25
toxcct21-Mar-05 22:25 
GeneralHELP: Printing in a region Pin
Vitaly Tomilov21-Mar-05 6:30
Vitaly Tomilov21-Mar-05 6:30 
GeneralEvent enumeration:compiles,links no output Pin
brilliant10121-Mar-05 5:58
brilliant10121-Mar-05 5:58 
GeneralRe: Event enumeration:compiles,links no output Pin
brilliant10121-Mar-05 6:00
brilliant10121-Mar-05 6:00 
GeneralRe: Event enumeration:compiles,links no output Pin
David Crow21-Mar-05 7:27
David Crow21-Mar-05 7:27 
GeneralHardware enumeration Pin
brilliant10121-Mar-05 5:57
brilliant10121-Mar-05 5:57 
This is the code from MSDN, using the api SetupDiGetClassDevEx () fuction to retrieve the list of current devices. But this program does not complies.
Please debug the code so that it can enlist all the hardware devices in the computer.

#include<windows.h>
#include<stdio.h>






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.

//int WINAPI WinMain(HINSTANCE h,HINSTANCE p,LPSTR l,int n)
//{



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;
GeneralRe: Hardware enumeration Pin
brilliant10121-Mar-05 5:59
brilliant10121-Mar-05 5:59 
GeneralRe: Hardware enumeration Pin
David Crow21-Mar-05 7:24
David Crow21-Mar-05 7:24 
GeneralCOM Pin
act_x21-Mar-05 4:26
act_x21-Mar-05 4:26 
GeneralRe: COM Pin
Vitaly Tomilov21-Mar-05 6:44
Vitaly Tomilov21-Mar-05 6:44 
GeneralPlease Help Pin
Rassul Yunussov21-Mar-05 3:41
Rassul Yunussov21-Mar-05 3:41 
GeneralToolTip Close button Pin
Gurra_Koo21-Mar-05 3:20
Gurra_Koo21-Mar-05 3:20 
GeneralSerial comms Pin
Karl Lloyd21-Mar-05 3:05
Karl Lloyd21-Mar-05 3:05 
GeneralBorder size Pin
caykahve21-Mar-05 2:35
caykahve21-Mar-05 2:35 
GeneralRe: Border size Pin
Ravi Bhavnani21-Mar-05 3:46
professionalRavi Bhavnani21-Mar-05 3:46 
GeneralRe: Border size Pin
caykahve22-Mar-05 7:34
caykahve22-Mar-05 7:34 
GeneralRe: Border size Pin
Vitaly Tomilov21-Mar-05 6:47
Vitaly Tomilov21-Mar-05 6:47 
Generalload ttf file and use it Pin
JabraJabra21-Mar-05 2:16
JabraJabra21-Mar-05 2:16 
GeneralRe: load ttf file and use it Pin
Chris Losinger21-Mar-05 8:59
professionalChris Losinger21-Mar-05 8:59 
GeneralAllocating Memory in a Static Library Pin
Joel Holdsworth21-Mar-05 1:53
Joel Holdsworth21-Mar-05 1:53 
GeneralRe: Allocating Memory in a Static Library Pin
HalfWayMan21-Mar-05 3:05
HalfWayMan21-Mar-05 3:05 
GeneralRe: Allocating Memory in a Static Library Pin
Joel Holdsworth21-Mar-05 3:47
Joel Holdsworth21-Mar-05 3:47 
GeneralSmalltalk Pin
Anand for every one21-Mar-05 1:43
Anand for every one21-Mar-05 1:43 

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.