Access Calculator Menu Bar

G

Guest

Hi all,
how can I get the handle to the menu bar/task bar of the calculator in a
PocketPC device to simulate following user stylus input: Edit->Paste.
Is there a general approach to my problem?
Can someone help me with this problem please?
 
A

Alex Feinman [MVP]

Calculator should suppord the standard shortcuts (Ctrl-V, Ctrl-C). You can
simulate those by sending WM_KEYDOWN, WM_CHAR and WM_KEYUP to the calc
window. To see the exactl values, run CeSpy while using virtual kbd to press
keys you need.

Instead of using shortcuts you can read the clipboard contents yourself and
feed the characters to calc.

I believe OpenNETCF SDF has all classes necessary to supoprt this
 
G

Guest

Hi Alex,
I'm thinking now of another approach to this by using SHFindMenuBar and get
so the handle to it. This would give me a more flexible piece of code that I
could use for other progs too. (forgot to say that I'm using C#)

Kind Regards
Andrej
 
A

Alex Feinman [MVP]

Still wrong. The menu item click results in WM_COMMAND sent to main app
window. Why not to send it yourself and save the trouble?
 
G

Guest

Hi Alex,
I tried to press Edit->Paste with the proceed of simulating key presses you
told me yesterday under the post "Simulate User Input" but unfortunately the
menu bar didn't receive anything. So I thought of getting some kind of handle
to the menu bar and then posting some events to open a menu would be a clean
solution.

Kind Regards
Andrej
 
G

Guest

Hi Alex,
your suggestion is I think really the best approach to avoid further
problems. I' ve tried following code (and a lot of similar ones) but wasn't
able to open the menu and select an item from it.


const int WM_COMMAND = 0x111;

IntPtr hWnd = FindWindow("Inbox", null);

Message msg =
Message.Create(hWnd, WM_COMMAND, new IntPtr(1), new IntPtr(1));
MessageWindow.SendMessage(ref msg);

Any suggestions how to access the menu bar?
Thanks for your fast and reasonable answers in advance!

Andrej
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top