Admittedly, this wouldn't be my ideal solution, but is it possible to emulate the "action" button on a pocket pc or smartphone For instance, if I've popped a CameraCaptureDialog, can I automate image capture and approval simply by pushing the keycode at it Or is it possible to raise any events against this dialog

SendKeys
dasduck
I think the mistake i've been doing is using HWND_BROADCAST and hoping that it would filter down to the camera api, but notes always seemed to intercept it first. I'll target the specific window now.
Many thanks for the info.
Robert Seiler
cool . that means you found a way to automatically trigger a photo with a pda, save it, and go back into the execution of your application.
How do you work out the filename that has been created can you look it up in the registry
?smail Hakk? Dereli
Francois FPS
Tim.Nielsen
SGriffiths
Andrew,
Would it be possible to see your code
I'm trying to do exactly the same thing but haven't had much success yet.
JALenz
so I tried every way I could think of to do this task in managed code ... wasn't happening.
tried to capture quality JPGs using the CameraCapture app from the PocketPC SDK as a base. wasn't working, couldn't seem to upgrade the media type, and I didn't even start to get into trying to build my own filter.
so, I went back to trying to send a message against the dialog ... and while SendKeys doesn't exist in the CF, I was able to use window messaging and the pump within C++ to accomplish my task.
to others interested: I am able to automatically capture 1280x1024 (or other specified resolutions) images from the Windows Mobile 5.0 CameraCaptureDialog, on timed intervals. I'll post a writeup when I'm out of work today. I am able to utilize all parameters (resolution, brightness, sepia tones on some devices, etc.) offered by the CameraCaptureDialog by the device deployed to.
thanks for the input ...
Jeffrey Becker
Are you including the "[Photo]" that gets automatically appended to a window's caption on the 2125 Also, do you have the proper dialog classname In C++ you can set the dialog's classname, but in C# it defaults to a value I don't have available to me right now, or I'd provide it. You can find it in Remote Spy however.
Also, you might try P/Invoke-ing the Win32 window-find functionality rather than using Win32.
Ravi Terala
Gary G. Little
The way I've done it (which I make no claims to being the correct method) is to open a camera dialog and at the same time start two timers, one to time out at 5 seconds, and one at 10 seconds.
After 5 seconds (I assume that the camera dialog has fully opened by now) the following code gets executed by the timer -
int hwnd = GetForegroundWindow();
SendMessage(hwnd, 0x312, 0xc5, 0xc50008);
This simulates pressing the take picture button.
0x312 is the WM_SENDKEY message and 0xc5 and 0xc50008 are the param values that I observed by first opening remote spy and pressing the camera fire button - These values may not be the same for your device.
After another 5 seconds have past (I assume that the picture has been captured and stored within this time) the following code gets executed -
int hwnd = GetForegroundWindow();
SendMessage(hwnd, 0x0111, 1, 0);
This simulates pressing the ok button in the camera capture dialog box.
AmeyaDaGr8
bwalkertn
Tim Ward 123
I've discovered I may be on thin ice with NDA and IP here (I'm writing code for a company I own 10% of, but am being paid for the code produced as well) so I'm going to pass on copying my code, however, I can point you in the right direction.
Get your window handle with FindWindow -- this can be P/Invoked in C#, but I did it in C++, but definitely plan to wrap it up in an invoke. The window name doesn't always match its caption -- the Cingular 2125, for instance, tacks on a [Photo] value to the title of the dialog window. Use RemoteSpy to get your window name for sure if the window call doesn't work with the obivous caption. (Then again, in C#, refactored, maybe you don't need to find the handle because you've already got it.)
With your window handle in hand, you'll want to SendMessage against the window -- WM_KEYDOWN, VK_RETURN. This emulates the return key -- which seems to be, for most (all ) devices, the same value produced by the photo action button.
Done.
BABU_NEO
public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public const int WM_KEYDOWN = 0x0100;
public const int WM_KEYUP = 0x0101;
public const int WM_COMMAND = 0x111;
public const int VK_RETURN = 0x0D;
public const int VK_WPARAM = 0x70;
[DllImport("CoreDll")]
public static extern IntPtr FindWindow(
string lpClassName, // class name
string lpWindowName // window name
);
[DllImport("CoreDll")]
public static extern IntPtr SendMessage(
IntPtr hWnd, // handle to destination window
uint Msg, // message
uint wParam, // first message parameter
uint lParam // second message parameter
);
[DllImport("CoreDll")]
public static extern IntPtr GetForegroundWindow();
}
and I am trying to programatically click the left menu key on a phone (a 2125 oddly enough):
IntPtr handle = Win32.GetForegroundWindow();
Win32.SendMessage(handle, Win32.WM_KEYUP, Win32.VK_WPARAM, 0xc0000001);
I got the value for VK_WPARAM from Remote Spy, I have tried several other combinations, but nothing seems to work....do you have any suggestions
Thanks.
Lucas