Incorrect Pararmeter error: 87 Why?

J

Jerry West

Dim did As SP_DEVINFO_DATA

hWnd& = SetupDiGetClassDevs(0, 0, 0, &H4)

did.cbsize = 28
sPropertyBuffer$ = vbNullString

lRet& = SetupDiGetDeviceRegistryProperty(hWnd&, did, &H1C,
lPropertyRegDataType&, sPropertyBuffer$, Len(sPropertyBuffer$),
lRequiredSize&)

The call to SetupDiGetDeviceRegistryProperty always fails with
ERROR_INVALID_PARAMETER. I have a valid handle in hWnd&. What could be wrong
here?

Any insight would be greatly appriciated.

JW
 
T

Tim Roberts

Jerry West said:
Dim did As SP_DEVINFO_DATA

hWnd& = SetupDiGetClassDevs(0, 0, 0, &H4)

did.cbsize = 28
sPropertyBuffer$ = vbNullString

lRet& = SetupDiGetDeviceRegistryProperty(hWnd&, did, &H1C,
lPropertyRegDataType&, sPropertyBuffer$, Len(sPropertyBuffer$),
lRequiredSize&)

The call to SetupDiGetDeviceRegistryProperty always fails with
ERROR_INVALID_PARAMETER. I have a valid handle in hWnd&. What could be wrong
here?


Why would you call that variable hWnd? That's certain to cause you gried
later on. Call it hDevInfo, for Pete's sake.

The rest of SP_DEVINFO_DATA has to be set to the class GUID and devnode
handle for the device you're trying to query. Have you done that? Post
the rest of the code and we'll see what we can do.
 
Top