Kiosk Style, Single Application Pocket PC Code
A number of people have asked lately how to "lock down" a Pocket PC so that it appears to the user as a single purpose, single application device. This behavior is sometimes called kiosk mode. Without being able to completely rewrite the device ROM and build a custom shell, it is still possible to program a commercial Pocket PC device so that it exhibits this behavior.
The basic idea is to store the original location / dimensions of the task bar / start menu (represented by the HHTaskBar window class) and the SIP in the RECT members m_rcTaskBar and m_rcSIP. Then move these windows off screen. The original dimensions are stored so that the windows can be restored if needed.
//Hide the task bar and SIP
m_hWndSIP = ::FindWindow(TEXT("MS_SIPBUTTON"), TEXT("MS_SIPBUTTON"));
m_hWndTaskBar = ::FindWindow(TEXT("HHTaskBar"), NULL);
if (::IsWindow(m_hWndTaskBar)){
RECT rcMain;
::GetClientRect(m_hWndTaskBar, &m_rcTaskBar);
::GetClientRect(m_hWnd, &rcMain);
::MoveWindow(m_hWndTaskBar, 0, -100, (m_rcTaskBar.right-m_rcTaskBar.left),(m_rcTaskBar.bottom-m_rcTaskBar.top), TRUE);
::MoveWindow(m_hWnd, 0, 0, (rcMain.right-rcMain.left), (rcMain.bottom-rcMain.top), TRUE);
}
if (::IsWindow(m_hWndSIP)){
::GetClientRect(m_hWndSIP, &m_rcSIP);
::MoveWindow(m_hWndSIP, 0, -100, (m_rcSIP.right-m_rcSIP.left),(m_rcSIP.bottom-m_rcSIP.top), TRUE);
}
Finally, in the .inf file used to build the CAB file installer for your application, add a shortcut to the application in the startup folder. To wit, in the inf file for building your cab:
[DefaultInstall]
...
CEShortcuts = SC.MyKiosk
...
[DestinationDirs]
SC.MyKiosk = 0, %CE4%
...
[SC.MyKiosk]
"MyKiosk",0,"MyKiosk.exe",%CE4%
0 Comments:
Post a Comment
<< Home