There is only one way to do this (edit: this is referring to the SIP in non-smartphone Windows Mobile, so I'm not sure it's relevant to your question), and it does involve simulating a mouse click on the 123 button. This is only half the problem, however, since you also need to know whether the keyboard is already in numeric mode or not. The way to do this is to peek a pixel near the upper left corner of the keypad - if you look at how the 123 button works, you'll see that it's system text on windows background, and then inverted in numeric mode (so the pixel will be the system text color only when in numeric mode). There's one more bit of weirdness you have to do to guarantee it will work on all devices (you have to draw a pixel on the keyboard, too).
Lucky for you, I have an easy-to-use code sample that does all this. Unlucky for you, it's in C#, but I think it should at least point you in the right direction.