Hi all,
The Inkey$() function returns its lastest entry infinitely after calling some Windows functions.
I add this issue while I was using my own dll functions, so first I thought the problem came from my dll.
Windows fuctions tested : ChooseColor(), MessageBox() & GetOpenFileName()
So I decided to test the behaviour of the Inkey$() function using only DBP commands : unfortunatly there's the same issue.
Self explanatory : Copy, Paste and Run the code below.
Press any key (except "Q" to quit) : everything will be ok.
Press the "T" key then click and click and click... endless because Inkey$() doesn't seems to read correctly the keyboard.
Answer as Integer : hwnd as DWORD : ScanKey as Integer
Load dll "user32.dll",1
hwnd = Call dll (1, "GetActiveWindow")
Repeat
Key$ = Upper$ (Inkey$())
ScanKey = Scancode ()
If Key$="T" // Requester Test - Inkey$ Issue
//If ScanKey=20 // Works Fine
Answer = Call dll(1, "MessageBoxA", hwnd, "Click any button.","Test",(0x20 || 0x04))
EndIf
Print "ScanKey = ",ScanKey," Key = ",Key$," Requester Answer = ",Answer
Until Key$="Q"
Delete dll 1
End
Notes :
- Using Scancode() instead of Inkey$() works fine.
- I made some other tests and I noticed that calling "Wait Key" after the Window function seems to reset the keyboard management in some way and make Inkey$() works again.
- Using Clear Entry Buffer doesn't solve the problem.
I Hope this will help.
Cheers,
Chris