G
Guest
hi...can anyone tell me why im getting an IntPtr of -1 being returned? the
device is plugged in and being recognized by windows....so i dont understand
this. Thanks
private void GetFiles(String str)
{
IntPtr ptrHandle;
IntPtr lpData;
short shrtInLength;
short shrtOutLength;
HidCaps oCaps;
try
{
ptrHandle = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0,
IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
HidD_GetPreparsedData(ptrHandle, out lpData);
HidP_GetCaps(lpData, out oCaps); // extract the device
capabilities from the internal buffer
shrtInLength = oCaps.InputReportByteLength; // get the
input...
shrtOutLength = oCaps.OutputReportByteLength; // ... and
output report lengths
//FileStream fs = new System.IO.FileStream(ptrHandle,
FileAccess.ReadWrite);
}
catch (Exception ex)
{
}
finally
{
HidD_FreePreparsedData(lpData);
}
}
device is plugged in and being recognized by windows....so i dont understand
this. Thanks
private void GetFiles(String str)
{
IntPtr ptrHandle;
IntPtr lpData;
short shrtInLength;
short shrtOutLength;
HidCaps oCaps;
try
{
ptrHandle = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0,
IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
HidD_GetPreparsedData(ptrHandle, out lpData);
HidP_GetCaps(lpData, out oCaps); // extract the device
capabilities from the internal buffer
shrtInLength = oCaps.InputReportByteLength; // get the
input...
shrtOutLength = oCaps.OutputReportByteLength; // ... and
output report lengths
//FileStream fs = new System.IO.FileStream(ptrHandle,
FileAccess.ReadWrite);
}
catch (Exception ex)
{
}
finally
{
HidD_FreePreparsedData(lpData);
}
}