[Windows Mobile Development and Hacking General] Night_Horse:
I have the same issue about the FileName. The string is empty just after the CameraCaptureDialog is openned.

but here is the method i used to take automatic captures:

I started a timer just after the dialog is openned and simulated the message sent by the capture button on my PDA... first u need the message number and the parameters it is used... here is how to get it..

1. open Remote spy from visual studio remote tools in all programs.

2. Connect to your Smartphone or PDA.

3. open the camera and from Remote spy.. click on Target>> Refresh.

4. check the windows list and you will find a camera window. choose it and from spy menu click messages.

5. now remote spy will show you all messages that is sent to the camera dialog, so it's time to press the capture button or equivalent from your smartphone or PDA. and after you press it close the camera dialog.

6. in the messages window check for the message sent when you pressed the capture button. take the message value, wparam, and LParam. *you might get two messages for the same button press. like key_Up and key_Down. mine worked with the key_Up. you might need to do some tries to find the right message neway*

now you have everything you need to simulate the capture key.

in ur code u will need to import both GetForeGroundWindow and SendMessage functions from CoreDll. and after openning the camera dialog enable a time to make sure the cameraDialog is openned and worked fine and then when the time ticks get the CameraDialog window handle using GetForeGroundWindow and the send the capture button message to it using SendMessage.

here is my full code.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Microsoft.WindowsMobile.Forms;

using System.Runtime.InteropServices;

using Microsoft.WindowsMobile.PocketOutlook;

using Microsoft.WindowsMobile.Status;

namespace CamCapture

{

unsafe public partial class Form1 : Form

{

[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();

public Form1()

{

InitializeComponent();

}

private void menuItem2_Click(object sender, EventArgs e)

{

Application.Exit();

}

private void menuItem1_Click(object sender, EventArgs e)

{

CameraCaptureDialog ccd = new CameraCaptureDialog();

ccd.Owner = this;

ccd.Mode = CameraCaptureMode.Still;

ccd.InitialDirectory = @"\My Documents\My Pictures";

ccd.DefaultFileName = @"test.jpeg";

ccd.Resolution = new Size(1600, 1280);

ccd.StillQuality = CameraCaptureStillQuality.High;

if (ccd.ShowDialog() == DialogResult.OK)

{

timer1.Enabled = true;

}

Show();

ccd.Dispose();

}

private void timer1_Tick(object sender, EventArgs e)

{

IntPtr hwnd = GetForegroundWindow();

SendMessage((IntPtr)hwnd, 0x201, 0x1, 0x10000D);

timer1.Enabled = false;

}

}

}