Page 1 of 1

[Done] PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Posted: Wed Sep 03, 2025 7:57 pm
by User_Russian
Tested this code in Windows x64.

If in function OpenHID() add optional parameter "SerialNumber"

Code: Select all

x=OpenHID(0, $1234, $1, 2)
the application crashes
[ERROR] Invalid memory access. (read error at address 2)
If pass a pointer to a variable, there is no crash, but the device is not found.

I also noticed that the HID library is missing a function HidID() (similar FileID(), WindowID() etc.).

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Posted: Wed Sep 03, 2025 8:07 pm
by infratec
An USB SerialNumber is a string. (like AARRNIBB9X3FZKXI)
This works without error:

Code: Select all

OpenHID(0, 1234, 456, @"123")
But it looks like a bug, I don't think that this is the intention.

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Posted: Wed Sep 03, 2025 8:21 pm
by User_Russian
Probably not a string.

Code: Select all

x=OpenHID(0, $1234, $1, "2")

Code: Select all

---------------------------
PureBasic
---------------------------
Line 1: Bad parameter type, number expected instead of string.

Code: Select all

x=OpenHID(0, $1234, $1, @"2")

Code: Select all

Device with requested VID/PID/(SerialNumber) not found

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Posted: Wed Sep 03, 2025 8:30 pm
by User_Russian
Figured it out. Really need to pass a string - result form HIDInfo(#PB_HID_SerialNumber).

Re: [Done] PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Posted: Sat Sep 06, 2025 1:13 pm
by Fred
Fixed.