Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Enable floating SIP control in IPAQ/Windows CE .NET

0.00/5 (No votes)
10 Dec 2002 1  
Enable floating SIP control in iPAQ/Windows CE .NET devices.

Introduction

This article give you the tips on how to have a floating SIP control in your Pocket PC/Windows CE .NET device. At the same time, you have learn on how to do a soft reset (without pressing any button) on your device.

Background

You need to have some basic idea on how to access the registry as well as changing the respective value. The key value in this article is changing the registry value in order to create a floating SIP control.

Using the code

To implement this is quite simple, all you need is to include the soft reset API declare from winioctl.h as shown below, so that you can call the reset function right after changing the registry value.

// FOR SOFT RESET USED ONLY
// ------------------------------------------------------------
#include <winioctl.h>
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, 
                            METHOD_BUFFERED, FILE_ANY_ACCESS)

extern "C" __declspec(dllimport) BOOL KernelIoControl(
    DWORD dwIoControlCode, 
    LPVOID lpInBuf, 
    DWORD nInBufSize, 
    LPVOID lpOutBuf, 
    DWORD nOutBufSize, 
    LPDWORD lpBytesReturned);
// ------------------------------------------------------------

Once you have declared the above API, then you are free to execute the declare function as the code show below:

// Soft reset the device
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);

Next is the registry location for SIP style where the OS reference to. This will be the key value before the OS proceeds to create the SIP control. Therefore, the SIP style is controlled by the following registry key:

HKEY_CURRENT_USER\ControlPanel\Sip\DragStyle
  • DragStyle = 0, means the SIP is non-movable.
  • DragStyle = 1, means the SIP is movable.

I have simplified the registry access by putting all the messy code into the few functions defined under the RegEdit.h and RegEdit.cpp. Hence, all you need is to call the SaveDWORD with the correct value when you tend to switch from non-movable to movable SIP control or vice-versa.

// Enable the movable SIP control
SaveDWORD(HKEY_CURRENT_USER, TEXT("ControlPanel\\Sip"), 
                                   TEXT("DragStyle"), 1);

// Disable the movable SIP control
SaveDWORD(HKEY_CURRENT_USER, TEXT("ControlPanel\\Sip"), 
                                   TEXT("DragStyle"), 0);

A soft reset is required for the changes made to take effect. Hence, after the above code is executed, the device is going to reset with the discuss reset function.

Points of interest

Feel free to explorer more on the Pocket PC registry setting and you will get more fun with it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here