Some notes on software development... RSS 2.0
# Thursday, 06 March 2008

Rather annoyingly Virtual PC 2004 & 2007 set the default folder location for Virtual Machine Configuration (.vmc) and Virtual Hard Disk (.vhd) files to a folder called My Virtual Machines in your My Documents.
This means users could inadvertently end up saving huge VPC disk images to their My Documents folder, not good if you use profile roaming ;-)

Luckily we can add a new environment variable called MYVIRTUALMACHINES with our preferred default location.


The next time Virtual PC is loaded it will pick up the environment variable as the new default.

Thursday, 06 March 2008 15:54:17 (GMT Standard Time, UTC+00:00)  #    -

Windows Mobile Developer Power Toys comes with a handy remote display application called ActiveSync Remote Display that allows you to control the device from your desktop. This is great for displaying running demos on real devices or capturing screen shots etc.

The steps to get it working for Windows CE are:

Download and install Windows Mobile Developer Power Toys

Connect the device via ActiveSync.

Start ActiveSync Remote Display from the desktop PC, somewhere in your start menu.

If you just get a blank white screen it means you are missing a file on the device.

ActiveSync Remote Display Blank Screen 

You need to copy the correct CPU version of cerdisp2.exe to the \Windows folder on the device.
For CE 4 and higher I use the version for my device (ARM CPU) located on my local machine here:

C:\Program Files\Windows Mobile Developer Power Toys\ActiveSync_Remote_Display\devices\wce400\armv4

Restarting ActiveSync Remote Display should now display the screen from the device with full mouse and keyboard support from your desktop.


One last may get a warning message about the OS or CPU every time you run ActiveSync Remote Display.
This is displayed because the application is older than the running CE version and is just a warning.


Thursday, 06 March 2008 10:04:06 (GMT Standard Time, UTC+00:00)  #    -
CE Devices
# Thursday, 28 February 2008

On a CE device, when a touch screen is pressed, the running application will receive a mouse click message. This message then gets filtered down through the application and eventually arrives at where it is supposed to be in the application level, i.e. click on a button control.

So to completely disable the touch screen on a Windows CE device you can suppress any mouse button messages that get sent from the device thus preventing them from getting dispatched to you application.

To do this you can add a filter object (that implements IMessageFilter) to the application's message pump, check the message type, if the message is a mouse click message then cancel it.

Unfortunately message filtering with CF 2.0 is not supported out of the box however, luckily for us the clever chaps at OpenNETCF have provided us with the classes we need to complete the task with their excellent Smart Device Framework library.

On to some is my DisableTouchScreenFilter class that implements the IMessageFilter:

using System;
using Microsoft.WindowsCE.Forms;
using OpenNETCF.Windows.Forms;
public class DisableTouchScreenFilter : IMessageFilter
    private const int WM_MBUTTONDBLCLK = 0x0203;
    private const int WM_LBUTTONDOWN = 0x0201;
    private const int WM_LBUTTONUP = 0x0202;
    public bool PreFilterMessage(ref Message message)
        bool result = false;
        if (message.Msg == WM_LBUTTONUP ||
            message.Msg == WM_MBUTTONDBLCLK ||
            message.Msg == WM_LBUTTONDOWN)
            result = true;
        return result;

You can actually check any Windows message that arrives at the PreFilterMessage method, however I have only defined the message constants that are required for handling the mouse click message.
For a full list of what all the Windows message are you can check out Windows Message (Enums).

To plumb in the filter to the application message pump you need to call the static AddMessageFilter method on the Application2 object. To remove the filter call the RemoveMessageFilter method passing in the same filter object.

An example of adding the message filter to the Application message pump:

Application2.AddMessageFilter(new DisableTouchScreenFilter());

You need to run your application using the Application2 class from the Smart Device Framework library.
The mouse message gets completely cancelled before it gets to any forms or controls. This means that absolutely no mouse click events will fire at all.
There may be a slight performance hit with the application due to the message filter evaluating ever message that gets passed to the application.

Thursday, 28 February 2008 18:01:41 (GMT Standard Time, UTC+00:00)  #    -
# Wednesday, 27 February 2008

I got the Internal error 2715 'Component' after I created an InstallShield component with only registry settings in it.

The error message from the log file is:

The specifield File Key component not found in the File Table

So the solution? Don't create InstallShield components that contain only registry settings and no files.

Wednesday, 27 February 2008 15:20:20 (GMT Standard Time, UTC+00:00)  #    -

Sign In
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2019
Hadrian Phillips

All Content © 2019, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)