Some times when developing Windows Mobile Application you might want to make sure that users cannot navigate to and use any of the other programs except your program. This means that the windows start button in the taskbar must be disabled .
Kiosk Mode Library for Windows Mobile and C#
There are some predefined functions in the coredll.dll in Windows Mobile
<DllImport("coredll.dll")> _ Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr End Function <DllImport("coredll.dll")> _ Public Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal visible As Integer) As IntPtr End Function
To Disable the Start Button , you can use
ShowWindow(FindWindow("HHTaskBar", Nothing), 0)
Note the HHTaskBar . This is a windows handle for the task bar , but when we hide this , this will hide the entire window along with the X button .
Instead , you can use the EnableWindow function with false as parameter to disable the window rather than hiding it or even the function SHFullScreen with the parameter ( SHFS_SHOWTASKBAR , SHFS_HIDETASKBAR,SHFS_SHOWSIPBUTTON,SHFS_HIDESIPBUTTON,SHFS_SHOWSTARTICON , SHFS_HIDESTARTICON ) .
Some times this might be more troublesome , if you want to disable the same on the other programs too like Calculator etc …but still enable the X button .
Here’s a simple Kiosk Mode Library that i found was simple and easy to use from the Windows CE Programming Blog
The functions are implemented in a Dll file (StartLock.dll) that is written using Embedded Visual C++ 4.0 , which means the functions are accessible from any managed language code like VB.NET / C# .
Simple isn’t it ?.
The list of functions supported by the library includes .
1. LockStartMenu();
2. UnlockStartMenu();
3. LockStartBar();
4. UnlockStartBar();
5. Lockdown(TCHAR*);
6. Unlockdown();
You can find more information on downloading and using the library in the Windows CE Programming’s
Mobile Development: Yet another kiosk mode library