Prem Prakash
Prem Prakash

Reputation: 91

Camera Resolution change in windows mobile 6.5

I wanted to change the camera resolution in windows mobile 6.5 through code. but its not working my code snippet is below.

CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog(); 
cameraCaptureDialog.Owner = this; 
cameraCaptureDialog.Resolution = new Size(800, 600);

Upvotes: 1

Views: 1091

Answers (1)

josef
josef

Reputation: 5959

Here is a snippet that I use to start the CameraCaptureDialog:

cameraDialog.Owner = this;
cameraDialog.InitialDirectory = @"\My Documents";
cameraDialog.DefaultFileName = "test.jpg";
cameraDialog.Title = "iCOMM Camera Demo";
cameraDialog.StillQuality = CameraCaptureStillQuality.Default;
cameraDialog.Mode = CameraCaptureMode.Still;

The diff is, that I do not use a free defined Size object but an exisiting resolution const given by the CameraCaptureDialog class.

As said, there should be a list of supported resoltions in the registry. In another code I use the following to get the known res's:

public cResolution[] getResolutions(){
cResolution[] cRes;
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(regSubResolution, false);
string[] subKeys = rKey.GetSubKeyNames();
cRes = new cResolution[subKeys.Length];
int i=0;
foreach (string s in subKeys)
{
    RegistryKey rKeySub = Registry.LocalMachine.OpenSubKey(regSubResolution + "\\" + s, false);
    string item;
    int w, h, hqfs, nqfs, lqfs, pw, ph;
    item = (string)rKeySub.GetValue("ItemString");
    w = (int)rKeySub.GetValue("Width");
    h = (int)rKeySub.GetValue("Height");
    hqfs = (int)rKeySub.GetValue("HighQualityFileSize");
    lqfs = (int)rKeySub.GetValue("LowQualityFileSize");
    nqfs = (int)rKeySub.GetValue("NormalQualityFileSize");
    ph = (int)rKeySub.GetValue("PreviewHeight");
    pw = (int)rKeySub.GetValue("PreviewWidth");
    cRes[i] = new cResolution(item, h, w, pw, ph, hqfs, nqfs, lqfs);
    i++;
    rKeySub = null;
}

But as said, this depends on the OEM implementation of the camera.

~josef

Upvotes: 1

Related Questions