PDA

View Full Version : Simulate touchscreen tap, or add ShortCut key.


SchumiX
31-07-2006, 08:23 AM
Hello,

I have such a problem. But first I will explain why I have that problem.
In company we are using a PocketPC with Windows Mobile 2002. And have only one apllication for work.
When connecting to Server we need to tap the left bottom corner of the screen.
Many of workers tap with diferent objects like cutters, pens, not with Stylus, so the left bottom corner become bad in 1-2 months, till the time I can't do nothing, just changing the screen.

So. There is a posibility to implement somehow a ShortCut to that menu, to avoid taping that part of screen? (Because after that in program we use only buttons.)
(Note: I have no source code for tha app.)

Any kind of help will be apreciate.
Thank you much!

levenum
31-07-2006, 09:30 AM
It's easy to simulate screen tap by code.
Do you have experience programming in C/C++?

If so all you have to do is write a little app that does the following:
HWND hWnd; //window handle

hWnd = FindWindow(L"BUTTON", L"Connect to server"); //this text is just an example
SendMessage(hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(5, 5)); //actually simulates the click

Then you can assign this app to a hardware button using device settings or put a shortcut to is in the start menu.

I don't know of any ready apps to just simulate a click, but there was a thread around here somewhere on a virtual mouse app for PPC. It's free so try searching for that. (Sorry, don't remember the link).

Good luck.

SchumiX
31-07-2006, 11:32 AM
Thank you man.
I'll try this...

SchumiX
03-08-2006, 11:08 AM
It's easy to simulate screen tap by code.
Do you have experience programming in C/C++?

If so all you have to do is write a little app that does the following:
HWND hWnd; //window handle

hWnd = FindWindow(L"BUTTON", L"Connect to server"); //this text is just an example
SendMessage(hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(5, 5)); //actually simulates the click

Then you can assign this app to a hardware button using device settings or put a shortcut to is in the start menu.

I don't know of any ready apps to just simulate a click, but there was a thread around here somewhere on a virtual mouse app for PPC. It's free so try searching for that. (Sorry, don't remember the link).

Good luck.

So I have not so many experience in C++ and nor in Visual Studio.
Can you provide me with full c++ code for Visual Studio 2005?

Thank you in advance.

OdeeanRDeathshead
04-08-2006, 05:26 PM
Here is another way. Just create a simple project in vis studio ( I am not using 2005 so I cant tell you what its called, if all else failes use the "hello world" option). Open the main .cpp file and after the includes delete everything. Paste this in....

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_ABSOL UTE,61439,1638,0,NULL);

return 0;
}


Then build the exe. Make a shortcut to the exe on your device and place it in the windows\start menu folder. When the user taps the shortcut the cordinates specified will get a mouse down message, not all ppc programs will rspond to this message but most bought software I have do.

As it is, this will hit the close button on a 240*320 display. To vary the target location see this from the documentation:

If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner.

...So you may need to play with it to hit the spot.

If that fails then just replace the
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_ABSOL UTE,61439,1638,0,NULL);
with levenum's code putting the name of the window you are talking about in instead of "Connect to server" to send the normal WM_LBUTTONDOWN message to that window.

SchumiX
07-08-2006, 10:04 AM
OdeeanRDeathshead, your method seems to work. I did it and application works proprely on my Magician.
But now the question is: I need that program for a PocketPC 2002 platform. How to do this in VS2005, can explain me anyone?

Thank you in advance.

levenum
07-08-2006, 10:20 AM
Actually, you can't write apps for WM2002 using VS2005.
You need eMbedded Visual C++ 3. It is available free from Microsoft, just search the site. You will also need to install Pocket PC 2002 SDK. (also free on MS site)

SchumiX
11-08-2006, 09:04 AM
Actually, you can't write apps for WM2002 using VS2005.
You need eMbedded Visual C++ 3. It is available free from Microsoft, just search the site. You will also need to install Pocket PC 2002 SDK. (also free on MS site)

Ok.. all this I installed.

I will try to do the program there. But problem become more complicated.

My PDA's are not HTC. They are modified by SYMBOL company. So.. I realized that i have no HARD BUTTON.
In start menu I can't let the application, only because START is not accessible. The only program is that for work and it's full screen.
The PDA have a keyboard.

The question is: it is possible to do in program a HOT_KEY combination, and run MOUSEEVENTF_LEFTDOWN only when HOT_KEY combination was pressed.
I understand that program must remain in memory to intercept that.

levenum
11-08-2006, 01:44 PM
Do you mean that there are no buttons on your device, only a keyboard?
Doesn't matter really because as far as windows is concerned keystrokes from device buttons and full keyboard are handled the same.
Sorry I am not really familiar with setting up hot keys, I think your app window needs to have input focus for that to work.

There is a function called SetWindowsHookEx that lets you hook all keyboard events so they will pass through your function. You can then have a small app in background (without UI) that will monitor any key combination you want and simulate the tap when necessary.

SchumiX
14-08-2006, 12:01 PM
Do you mean that there are no buttons on your device, only a keyboard?


Yeah.... it looks like this http://www.symbol.com/PDT8100

cjb
15-08-2006, 12:48 PM
I do not know if you can throw some cash at your problem but SKScHeMa from www.s-k-tools.com can wait for an application to start then execute a script. In the script you can simulate both tap and tap and hold actions.

Hope that helps.

Regards cjb.

OdeeanRDeathshead
15-08-2006, 03:03 PM
One of those buttons must correspond to the buttons on the normal ppc. It would be overkill too write an app to run constantly just to redirect one tap. Do you have the opportunity to ever start the unit without the fullscreen program running, if so you could experiment with the button assignments to find the correct one. If the author of the custom software on the thing was half good they could have disabled those buttons assignments while its running, but if they didn't thats the best solution.

If that fails perhaps a program to run after powerup and ask if the user wants to connect to the server could work. It could show for 10 seconds then end. There was a thread here somewhere about programs starting on powerup but I can't seem to find it now.

edit:
I read the specs and it has two "side scan keys", I bet they are your buttons waiting to be reassigned!

SchumiX
16-08-2006, 02:13 PM
One of those buttons must correspond to the buttons on the normal ppc. It would be overkill too write an app to run constantly just to redirect one tap. Do you have the opportunity to ever start the unit without the fullscreen program running, if so you could experiment with the button assignments to find the correct one.

No one of that buttons corespond to CALENDAR or CONTACTS or CAMERA or RECORD button.
I can start the device without work program. Also I don't need to simulate tap, because I own my PDA and have knoweledge how to use it.
Users don't know much... for that i disables all. Only Work program in fullscreen mode without START MENU.


I read the specs and it has two "side scan keys", I bet they are your buttons waiting to be reassigned!

This is a PDA with barcode scanner. That 2 buttons named "side scan keys" are only for SCANNER and are not programable.


TO ALL: Thank you for your support![/quote]

SchumiX
16-08-2006, 02:18 PM
I do not know if you can throw some cash at your problem but SKScHeMa from www.s-k-tools.com can wait for an application to start then execute a script. In the script you can simulate both tap and tap and hold actions.

Hope that helps.

Regards cjb.

Thanks for help.
I can't do any investitions in that. :(
More of that it's not the same I need. I need to simulate this not only at start, also during work.

OdeeanRDeathshead
17-08-2006, 08:55 AM
Yes, so make the prgram asking if a connect is needed run when the power button is pressed. If the user needs to connect they press off then on then the window comes up asking if a simulated tap is needed (I do not mean reset). If the full off is not desireable then dose your unit change the brightness when the power button is held down? If so, and if it is using the standard name for the named event to signal brigtness changes then you could make the tap simulate program run all the time in a loop but waiting for the brigtness change event. Waiting will take up almost no processor time and the program is so small it takes up almost no memory! The user just has to hold the power button for several seconds and the your window will pop up. The down side is that your app will also have to save then restore the brigtness settings so the user dose not need to manualy reset the brigtness level.