Hi Greetings , I would like to know how to use GetRawInputDeviceList and GetRawInputDeviceInfo APIs in PowerBuilder.
- David Canicoba
- PowerBuilder
- Saturday, 23 September 2017 15:52 PM UTC
- Page :
- 1
There are no replies made for this question yet.
However, you are not allowed to reply to this question.
However, you are not allowed to reply to this question.
I'm waking up this discussion because I have a requirement to distinguish whether input is coming from the keyboard or a usb bar code scanner. Windows doesn't provide this insight to the Key event but an App can get it from the RawInputDeviceApi
I wondering if you have some insight into this HID (human interface device) API
This article has a c# example https://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard
Based on this MS definition:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-rawinputdevice
I created this structure
global type rawinputdevice from structure
uint usUsagePage
uint usUsage
ulong dwFlags
ulong hwndTarget
end type
To get started : Based on your suggestion above I added these two external function definitions
//Calling this function causes a system error -- wrong type for param 1 ??
function UINT GetRawInputDeviceList_size( long usize , ref UINT puiNumDevices, ref UINT cbSize) library 'user32.dll'
//Calling this function returns -1 ??
function UINT GetRawInputDeviceList( ref RAWINPUTDEVICE pRawInputDevices [ ] , ref UINT puiNumDevices, ref UINT cbSize) library 'user32.dll'
Here's the PB code (button click)
RAWINPUTDEVICE str_RawInputDevices_null ,str_RawInputDevices [ ]
UINT lui_NumDevices, lui_cbSize
int rc
//setnull (str_RAWINPUTDEVICEs_null) // compiler won't allow this
//long lsize
//setnull(lsize)
//GetRawInputDeviceList( lsize , lui_NumDevices, lui_cbSize) //<<causes system error
rc = GetRawInputDeviceList( str_RawInputDevices , lui_NumDevices, lui_cbSize)
Suggestion?
Thanks
Yakov
yakov.werde@iongroup.com
Check your data types here:
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types?redirectedfrom=MSDN
Handles (HWND for example) should be Longptr so that it will work in 64bit.