By using following simple code it is possible to check if a key (e.g. "A") was pressed. But it worked only if the program is running in "foreground" (active window).
May question is:Is it possible to modify the code that pressing a key (e.g. A) change to a specified window independent which window is the active window (foreground window).
I want to implement a function, if someone enter the room and he may not or should not see what I doing.
Thanks in adwance
Code: Select all
Structure keys
Wert.l
Name.s
EndStructure
NewList Keys.keys()
AddElement(Keys())
ddElement(Keys())
Keys()\Wert = #VK_A
Keys()\Name = "VK_A"
AddElement(Keys())
Keys()\Wert = #VK_B
Keys()\Name = "VK_B"
OpenWindow(0,0,0,400,300,"Test")
Repeat
ereignis.l = WaitWindowEvent()
If ereignis.l = #WM_KEYDOWN
If EventlParam() & %01000000000000000000000000000000
Debug Str(EventwParam()) + " ..."
Else
ForEach Keys()
If EventwParam() = Keys()\Wert
Debug Keys()\Name + " *was pressed*"
EndIf
Next
EndIf
EndIf
Until ereignis.l = #PB_Event_CloseWindow