I am trying to detect mouse clicks generated by an active stylus on a tabletpc. http://www.mjtnet.com/blog/2006/03/31/a ... een-click/ is what I am basing my effort on. OnEvent>KEY_DOWN,VK1,0,MouseClick is where I am having a problem. When I use the physical mouse, it works reliably, but using the active stylus does not work most of the time.
I am running the tabletpc version of windows xp sp2 on a toshiba M700. My program runs in a Citrix session; however even outside of citrix I am having some problems. Are their special virtual key codes for the stylus?
Thank you,
ken
OnEvent>KEY_DOWN,VK1,0,MouseClick problem detecting pen
Moderators: JRL, Dorian (MJT support)
I don't have a stylus to test with but my suspicion is that it should behave as a normal mouse.
SRT>MouseClick
MDL>Got here
END>MouseClick
Let us know.
"Most of the time" makes me wonder if the click is detected and the subroutine execution is out of time with what ever you are trying to accomplish. This can be easily tested by placing a modal message in the "MouseClick" subroutine so that timing is not an issue. Something like:but using the active stylus does not work most of the time.
SRT>MouseClick
MDL>Got here
END>MouseClick
Let us know.
Modal message suggests click not activating
Thank you for the suggestion. I have set up a short macro that only goes to a modal message. I have to do multiple clicks with the stylus before it activates.
When you say "active stylus" I assume you mean the stylus is plugged into the computer and that the stylus is doing the clicks not a touch screen?
Is the stylus connected via USB, PS/2 or Serial?
Is there also a mouse plugged in? Or a touch pad? Or both?
What connection type for the mouse? (USB, PS/2 or Serial)
Have you tried unplugging the mouse to see if the stylus becomes more reliable?
My first notion is that you might have multiple mouse drivers causing confusion. I think that the Key_Down event detection is using standard Microsoft provided API functions. The Virtual Key Codes are sent from the operating system and being detected by the API functions
If the computer works flawlessly now, you may not want to risk doing things such as reinstalling the mouse drivers or installing updated drivers. Doing that might or might not make any difference. The order they are installed might or might not make a difference.
Here's another something to try. Use the Windows APIs and see if they detect the stylus. Save this to a script and run it using only the keyboard and you should see the two numbers in the message box stay the same in consecutive runs. (Press F9 while in the editor or Ctrl+R from the main menu) If you use the mouse to click and run it the right number should be 1 and the left number should alternate form 0 to 1 in consecutive runs. Don't click on the message box either as clicking on anything will alter the results. To close the message box press enter while it has focus.
Is the stylus connected via USB, PS/2 or Serial?
Is there also a mouse plugged in? Or a touch pad? Or both?
What connection type for the mouse? (USB, PS/2 or Serial)
Have you tried unplugging the mouse to see if the stylus becomes more reliable?
I don't think so but there are mouse button codes from VK1 through VK5. Have you tried setting up to detect anything other than VK1?Are their special virtual key codes for the stylus?
My first notion is that you might have multiple mouse drivers causing confusion. I think that the Key_Down event detection is using standard Microsoft provided API functions. The Virtual Key Codes are sent from the operating system and being detected by the API functions
If the computer works flawlessly now, you may not want to risk doing things such as reinstalling the mouse drivers or installing updated drivers. Doing that might or might not make any difference. The order they are installed might or might not make a difference.
Here's another something to try. Use the Windows APIs and see if they detect the stylus. Save this to a script and run it using only the keyboard and you should see the two numbers in the message box stay the same in consecutive runs. (Press F9 while in the editor or Ctrl+R from the main menu) If you use the mouse to click and run it the right number should be 1 and the left number should alternate form 0 to 1 in consecutive runs. Don't click on the message box either as clicking on anything will alter the results. To close the message box press enter while it has focus.
Code: Select all
Let>VK_LBUTTON=1
LibFunc>User32,GetKeyState,GKSres,VK_LBUTTON
LibFunc>User32,GetAsyncKeyState,GKASres,VK_LBUTTON
GetAsyncKeyState
Message>%GKSres% %GKASres%
Wait>2