Posts tagged ‘Programming’

Windows Mobile: Kiosk Mode Series, part 2

In the first part of this series I showed how to make your compact framework application full screen or remove the Start icon from the menu bar. Now we will take a look at the task bar.

The task bar is at the top of your screen (except for fullscreen applications) and shows valuable information like the connection status, battery status or the current time.

Not full screen, taskbar not locked

This is a kiosk mode risk. The user is able to click the symbols in the taskbar and gets a popup menu with some icons. These icons enable the user to change connection settings, power management settings and others. You propably do not want to allow the user to make changes to some or all of the possible changes.

For example, clicking on the phone or signal strength icon will bring up this dialog:

The user can then change connection settings and activate or deactivate radios. Possibly a source for a bunch of support calls, if the user accidently changes connection settings.

Continue reading ‘Windows Mobile: Kiosk Mode Series, part 2’ »

All you need to know about unicode

Recently I stumbled about this great article about ASCII, 7 and 8 Bit, codepages, Multi byte, Wide byte and unicode: http://www.joelonsoftware.com/articles/Unicode.html

If you ever get in trouble with wrong encoding display of chars, give this article a try to know the backgrounds.

As you know, Windows CE and Windows MobileĀ  is always unicode except for serial and socket communication. But the truetype fonts available on Windows Mobile devices mostly support only common chars, there file size is about 600K. The file size of Arial Unicode MS is about 22MB.

regards

Mobile Development – Simple serial communication application

Here is a simple application to connect to a serial port. The idea is based on the need of having an application to send demo print files to a virtual comm port connected to a bluetooth printer.

Update 16. March 2011: Added dialog to connect to BT printer by BT Address on Intermec devices. New source and binary at code.google.com.

Update 21. March 2011: Splitted source code and providing three different flavours:
CommAppCFSerial does serial comm only.
CommAppCFbtSearch provides BT connect (Intermec Devices only) and BT discovery
CommAppCF itself is a unstable working release
see code.google.com/p/win-mobile-code … Executables are in bin subdirs.

You can enter and send texts to or send a whole file to the port. Additionally you are able to send ASCII codes by using \xAB syntax, where AB is the hex code of the byte you would like to send.

There is nothing special with the code except the hex decoding/encoding and the possibility to send a file.

Continue reading ‘Mobile Development – Simple serial communication application’ »

Mobile Development – subclassing the Camera View (CameraCaptureDialog, SHCameraCapture)

If you are running a kiosk mode app but need to provide the camercapture dialog on Windows Mobile 5 or later, you may need to disable the one or other click in the CameraCapture dialog.

This article uses a technique known as subclassing as already used and decribed in my StartButtonHookWM65 article. For the CameraCapture dialog the code has been revised and you can now subclass any known window class and disable clicks within the Windows Mobile menu bar.

        private string _winClassName = "HHTaskbar";
        public string winClassName
        {
            get { return _winClassName; }
            set {
                if (this.oldWndProc == IntPtr.Zero) //only allow change before subclassing
                    _winClassName = value;
            }
        }
...
        /// <summary>
        /// SubClassing: Install the wndproc hook
        /// </summary>
        /// <returns></returns>
        private bool hookWindow()
        {
            //find the window to hook
            IntPtr hWndHooked = FindWindow(_winClassName, IntPtr.Zero);
            if (hWndHooked == IntPtr.Zero)
                return false;
            //enable the taskbar, not realy necessary
            EnableWindow(hWndHooked, true);
            //already installed?
            if (oldWndProc == IntPtr.Zero)
            {
                //find the menu_worker window
                IntPtr hwndMenu_Worker = FindWindow("menu_worker", IntPtr.Zero);
                if (hwndMenu_Worker != IntPtr.Zero)
                {
                    //get the child window which has the buttons on it
                    IntPtr hwndToolbar = GetWindow(hwndMenu_Worker, GetWindow_Cmd.GW_CHILD);
                    if (hwndToolbar != IntPtr.Zero)
                    {
                        _mHwnd = hwndToolbar;       //store to remember
                        SubclassHWnd(hwndToolbar);  //subclass the wndproc
                    }
                }
            }
            return true;
        }

As the call to CameraCaptureDialog will block and you can not subclass it before it is launched, I use a timer that will subclass the dialog assuming it will show after the call to .ShowDialog().

        private System.Windows.Forms.Timer timer;
        hwndutils subClassUtils;
        private void ShowCamera()
        {
            CameraCaptureDialog cdlg = new CameraCaptureDialog();
            cdlg.DefaultFileName="picture.jpg";
            cdlg.InitialDirectory = "\\My Documents";
            cdlg.Mode = CameraCaptureMode.Still;
            cdlg.Owner = this.pictureBox1;
            cdlg.StillQuality = CameraCaptureStillQuality.High;
            cdlg.Title = "Take a picture and Select";
            cdlg.Resolution = new Size(240, 320);
            cdlg.VideoTypes = CameraCaptureVideoTypes.All;

            //subclass main window with delay
            subClassUtils = new hwndutils();
            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;

            DialogResult dRes = cdlg.ShowDialog();
...
        void timer_Tick(object sender, EventArgs e)
        {
            subClassUtils.winClassName = "Camera View";
            subClassUtils.CloseButtonDisabled = true;
            System.Threading.Thread.Sleep(500);
            if(subClassUtils.CloseButtonDisabled)
                timer.Enabled = false;

        }

In the line “subClassUtils.CloseButtonDisabled = true;” the subclassing (or the hook) will be activated and clicks on (OK) will not be accepted.

Code subclassing.cs download: [Download not found]