|
Inicio → WINDEV 2024 → window information when barcode scann (GetAsyncKeyState api ?) |
window information when barcode scann (GetAsyncKeyState api ?) |
Iniciado por trian, 04,sep. 2018 21:30 - 6 respuestas |
| |
| | | |
|
| |
Publicado el 04,septiembre 2018 - 21:30 |
I try to make a program that popup window information when user scan barcode . The problem is that program maybe not have focus at this time . So i make a procedure running on timer and i try to grup the barcdode reader with out of luck. i need to use something like GetAsyncKeyState system api , when the program is running on background and not have focus i try GetAsyncKeyState but i need to declare the key pressed parameter , how can declare that? or anyone have any other idea? |
| |
| |
| | | |
|
| | |
| |
Publicado el 04,septiembre 2018 - 22:40 |
Hi
there are 2 ways for barcode readers to function: as keyboard emulation, or as a barcode reader.
The second way allows to capture events/scans easily, but is dependent on using the barcode maker API/SDK/Documentation... This is the way to go to obtain the described result.
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
On 9/4/2018 1:30 PM, trian wrote:
I try to make a program that popup window information when user scan barcode . The problem is that program maybe not have focus at this time . So i make a procedure running on timer and i try to grup the barcdode reader with out of luck. i need to use something like GetAsyncKeyState system api , when the program is running on background and not have focus i try GetAsyncKeyState but i need to declare the key pressed parameter , how can declare that? or anyone have any other idea? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 30 mensajes |
|
Publicado el 05,septiembre 2018 - 07:22 |
Hello, Thank you for answer. Clients have different type of barcode readers so i thing i need to use the keybord emulator hard way. |
| |
| |
| | | |
|
| | |
| |
Publicado el 05,septiembre 2018 - 14:33 |
Hi again,
On 9/4/2018 11:22 PM, Mister TRIANTAFILLOS wrote:
Hello, Thank you for answer. Clients have different type of barcode readers so i thing i need to use the keybord emulator hard way.
well, in keyboard emulation, you question becomes: how to intercept keystrokes when my program doesn't have focus; and even worse than that, how to recognize that the keystrokes in question are coming from the barcode reader.
The only thing that comes to mind is to: 1. configure the barcode reader so that it adds a special char (your choice) at the beginning of the barcode. All barcode readers should be configurable that way.
2. add a key HOOK (see windows api) on that special char at the windows level (AFAIK, you will need admin privileges to do that, so your program will have to be run at least once in elevated privileges mode)... When you do that, your program will be called and you will be able to get the focus back and hence the barcode... Not tested, but that SHOULD work.
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 30 mensajes |
|
Publicado el 05,septiembre 2018 - 18:07 |
I was able to read the barcode scanner or the keyboard without having the focus on my program. The code is below, procedure running timer scedule infinite. Now I want to find a way to recognize if the user use input keyboard or a scaner, do not run the code procedure if not uses the keybord.
Procedure check_GetAsyncKeyState()
GetAsyncKeyState is API Description GetAsyncKeyState..DLLName = "user32" GetAsyncKeyState..FunctionName = "GetAsyncKeyState" GetAsyncKeyState..ReturnType = apiSystemInt GetAsyncKeyState..Parameter[1]..Type = apiInt_4
nResult_tmp is int sKey_tmp is string i is int
IF GetAsyncKeyState(i) <>0 THEN Info(GetAsyncKeyState(i)) END FOR i = 2 TO 90 nResult_tmp = 0 nResult_tmp = GetAsyncKeyState(i)
IF nResult_tmp = -32767 OR nResult_tmp = 1 THEN sKey_tmp = Caract(i) IF i = 13 THEN sKey_tmp = CR END EDT_NoName1= EDT_NoName1 + sKey_tmp END END
|
| |
| |
| | | |
|
| | |
| |
Miembro registrado 26 mensajes |
|
Publicado el 17,septiembre 2018 - 17:35 |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 30 mensajes |
|
Publicado el 17,septiembre 2018 - 19:58 |
Thank you for your answer. My code with GetAsyncKeyState its not working all the time and its not working for what i need if user do fast scans. Yes its better solution raw input system api handler. I make a new code... with raw inpup code i have 100% the barcode input. |
| |
| |
| | | |
|
| | | | |
| | |
|