I want to control an IP Camera from within a VFP Form.
I have several arrow images on the form with mousedown and mouseup events. e.g.
MouseDown
thisform.olecontrol1.DecoderControl(6) && keeps moving the camera to the left until......
MouseUp
thisform.olecontrol1.DecoderControl(1) && stops moving the camera, triggered by the mousedown event.
-----------------
I want to do the same with the arrow keys on the keyboard. But there is no KeyDown and KeyUp event.
I use KeyPreview=.t. so the form intercepts the keypress. I can start moving the camera, but all subsequent keypresses are built up in the buffer. I can clear the buffer with clear typeahead, but this won't work properly. I have to release and press again. I want to move for as long as the key is pressed...
Question: How to simulate KeyDown and KeyUp, like the Mouse events?
I have several arrow images on the form with mousedown and mouseup events. e.g.
MouseDown
thisform.olecontrol1.DecoderControl(6) && keeps moving the camera to the left until......
MouseUp
thisform.olecontrol1.DecoderControl(1) && stops moving the camera, triggered by the mousedown event.
-----------------
I want to do the same with the arrow keys on the keyboard. But there is no KeyDown and KeyUp event.
I use KeyPreview=.t. so the form intercepts the keypress. I can start moving the camera, but all subsequent keypresses are built up in the buffer. I can clear the buffer with clear typeahead, but this won't work properly. I have to release and press again. I want to move for as long as the key is pressed...
Code:
KeyPress event
if nkeycode=19
thisform.olecontrol1.DecoderControl(6)
sleep(1000) && move for 1 second, sleep declared earlier
thisform.olecontrol1.DecoderControl(1)
nodefault
clear typeahead
endif