S
Steve
Hi all,
Thanks to repies from my previous post, I am now able to get device info
from the system. However, I am having a problem with the final part,
getting a device description. Here is the snippet:
..
..
' Get the device description, 1st call
SetupDiGetDeviceRegistryProperty( _
hDevInfo, DeviceInfoData,SPDRP_DEVICEDESC, vbNull, IntPtr.Zero, buffersize,
buffersize)
' create a buffer to receive the decsription
Err.Clear()
Dim Buffer As IntPtr = Marshal.AllocHGlobal(buffersize)
RetError = Err.LastDllError
'2nd cal
SetupDiGetDeviceRegistryProperty( _
hDevInfo, DeviceInfoData,SPDRP_DEVICEDESC, vbNull, Buffer, buffersize,
buffersize)
Now, the problem is that the Dim to create the Buffer returns
ERROR_INSUFFICIENT_BUFFER which I dont understand, as I am creating the
buffer in the first place!
The two calls to get the device work as expected, but the second does not
return any data because the buffer has not been created. What am I doing
wrong?
Many thanks in advance,
Steve.
Thanks to repies from my previous post, I am now able to get device info
from the system. However, I am having a problem with the final part,
getting a device description. Here is the snippet:
..
..
' Get the device description, 1st call
SetupDiGetDeviceRegistryProperty( _
hDevInfo, DeviceInfoData,SPDRP_DEVICEDESC, vbNull, IntPtr.Zero, buffersize,
buffersize)
' create a buffer to receive the decsription
Err.Clear()
Dim Buffer As IntPtr = Marshal.AllocHGlobal(buffersize)
RetError = Err.LastDllError
'2nd cal
SetupDiGetDeviceRegistryProperty( _
hDevInfo, DeviceInfoData,SPDRP_DEVICEDESC, vbNull, Buffer, buffersize,
buffersize)
Now, the problem is that the Dim to create the Buffer returns
ERROR_INSUFFICIENT_BUFFER which I dont understand, as I am creating the
buffer in the first place!
The two calls to get the device work as expected, but the second does not
return any data because the buffer has not been created. What am I doing
wrong?
Many thanks in advance,
Steve.