Archive for the ‘CodeProject’ Category.

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’ »

Windows Mobile: Kiosk Mode Series, part 1

Hello

I would like to start a series of articles of how you can lockdown your application user in your application. How can you achieve a kiosk mode application, where the user is only allowed to do what you define.

The first article is about the Windows Start and Done Icon in menu bar and about fullscreen. You may already know, how to hide the start and done icon permanently from a Windows Embedded Handheld (Windows Mobile 6.5.3) device: Link

But there is also a temporary way using the same approach. The trick is to change the registry keys, that make the OS believe you have hardware buttons for Start and Done, BEFORE you show your CSharp form.

Before Windows Embedded Handheld (WEH, or Windows Mobile 6.5.3), you are able to use SHFullScreen API calls. But this will not work with WEH. Neither the flags SHFS_HIDESIPBUTTON nor SHFS_HIDESTARTICON will work. The LockDown.cs class also includes code for that and you may test the functions with the Test-Application.

The class I am talking about is called LockDown. There is also a Test-Application (OEMTitleBarHandler, dont ask me about the name selection) to test all functions I will describe.

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

Getting rid of obsolete Microsoft Windows Mobile Remote Adapter s

As a windows mobile programmer I have to fight with ActiveSync aka Windows Mobile Device Center. The newer WM devices come with enhanced network function via USB ActiveSync/WMDC and then each time a new device is connected, you will get a new Mobile Remote Adapter with a new number at the end.

First, I dont need any partnership and so I change my system to do GuestOnly connections with WMDC (Windows Mobile 7, 64Bit system).

OK, second annoyance is the awlays coming up WMDC or WMDC+Mobile Registration Wizard. These Popups can be avoided by changing the call to WMDC.exe to WMDCbase.exe. See also this post.

So, I can connect one of the several devices I have currently for development support (about 10-30) without annoying popups.

But then I found, that for each device and sometimes multiple times, Windows installs a new “Microsoft Windows Mobile Remote Adapter” in Device Manager. I found about 88 instances, where only ONE is needed. Before you can see the inactive adapters, you have to enable Show_Hidden_Devices. One way to show hidden devices is this []:

  1. Click Start, point to All Programs, point to Accessories, and then click Command Prompt.
  2. At a command prompt, type the following command , and then press ENTER:
    set devmgr_show_nonpresent_devices=1
  3. Type the following command a command prompt, and then press ENTER:
    start devmgmt.msc
  4. Troubleshoot the devices and drivers in Device Manager.

    NOTE: Click Show hidden devices on the View menu in Device Manager before you can see devices that are not connected to the computer.

  5. When you finish troubleshooting, close Device Manager.
  6. Type exit at the command prompt.

To remove the hidden, inactive Mobile Remote Instances, you can now right click on every instance, then click UnInstall and then [OK]. But for 88 instances, that is a bunch of clicking.

As programmer, I searched of a way to remove these instances programmatically. OK, I digged google and found DevCon, a tool to manage devices and instances from the command line. Unfortunately, I had to download a CD image of Windows WDK to get DevCon.exe. Then I found a site which described howto install DevCon only.

With the help of DevCon.exe, I produced a list of “Microsoft Windows Mobile Remote Adapter” instances, removed to not numbered one and then built a list of DevCon commands to remove the obsolete instances.

List all Windows Mobile Remote Adapters into a file:

devcon findall "USB\VID_067E&PID_1003&REV_0000" >wm_remote_adapters.txt

“USB\VID_067E&PID_1003&REV_0000” is the identifier for Windows Mobile Remote Adapter (you can find this by right clicking the instance in device manager and select properties).

USB\VID_067E&PID_1003\0040056A-0E9D-0801-0DE0-01130400682B  : Microsoft Windows Mobile Remote Adapter #59
USB\VID_067E&PID_1003\0040056A-0E9D-0801-1B10-010E04000801  : Microsoft Windows Mobile Remote Adapter #6
USB\VID_067E&PID_1003\0040056A-0E9D-0801-0B70-000E0400BA61  : Microsoft Windows Mobile Remote Adapter #24
USB\VID_067E&PID_1003\0040056A-0E9D-0801-1990-001104000E40  : Microsoft Windows Mobile Remote Adapter #77
USB\VID_067E&PID_1003\99461300-B56A-0801-DD17-0FBB99944738  : Microsoft Windows Mobile Remote Adapter #89
...

Then, in the list wm_remote_adapters.txt, I replaced all line starts etc and built this cmd list:

devcon.exe remove "@USB\VID_067E&PID_1003\0040056A-0E9D-0801-0590-010E0400A43B"
devcon.exe remove "@USB\VID_067E&PID_1003\99461300-B56A-0801-5AD3-B56444802FC3"
devcon.exe remove "@USB\VID_067E&PID_1003\99461300-B56A-0801-B87A-D1874E00C078"
devcon.exe remove "@USB\VID_067E&PID_1003\0040056A-0E9D-0801-1640-01100400B075"
...

Then I saved this cmd list as remove-adapters.cmd and started it from the command prompt. And, voila, all obsolete adapters are gone for now.

From time to time I have to rebuild the lists again to get rid of these many obsolete adapters.

Mobile Development: AutoHide Windows Mobile Device Center 2

In an earlier post I wrote about a tool to autohide the annoying WMDC window. As a developer I dont like to keep WMDC come up every time I connect a device. I just need to know, if the device is connected or not.

Fortunately, Henkie leaved a comment about a usefull alternative for WMDC. But as commented here, no visual control of the connection.

Now I started to think about a small tool to have a visual control of WMDC connected or not. I had to use RAPI either provided by MS or via OpenNetCF.Desktop.Communication. Although the OpenNETCF one works OK, I was not satisfied, as it was impossible to get a connection status without disconnect/connect. So I went back to WIN32 API and wrote this small tool based on DeviceInfo sample of Windows Mobile 6 SDK.

First I again messed up with notification icons in Windows 7 (64bit). But the icon may be removed or not, depending on Windows 7 decisions I dont know.

So the tool uses a simple window and an icon to let you know the connection status.

Just start the tool and the icon and edit window background will show, if device is connected or not. The application icon in the title bar as in the taskbar button will change from gray to color for a connected versa a disconnected device.

Visual Studio 2008 C/C++ Win32 code and exe: [Download not found]