Wenn man seine PocketPC Anwendung (2003 oder 2005 mit .NET Framework 1.1 oder 2.0) im so genannten "Kiosk"-Mode ausführen möchte, um zum Beispiel das Startmenü zu verstecken hilft folgende Klasse weiter, die ich erstellt habe:
Public
Class Fullscreen
Private Const SHFS_HIDETASKBAR As Integer = &H2
Private Const SHFS_HIDESIPBUTTON As Integer = &H8
Private Const SHFS_HIDESTARTICON As Integer = &H20
Private Const SWP_NOZORDER As Integer = &H4
Declare Function GetCapture Lib "coredll.dll" () As IntPtr
Declare Function SHFullScreen Lib "aygshell.dll" (ByVal hWnd As IntPtr, ByVal state As Integer) As Boolean
Declare Function SetWindowPos Lib "coredll.dll" (ByVal hWnd As IntPtr, _
ByVal hWndInsertAfter As IntPtr, ByVal x As Integer, _
ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, _
ByVal flags As Integer) As Boolean
''' <summary>
''' Versteckt alle Elemente, um den Pocket PC im Kiosk-Mode auszuführen
''' </summary>
''' <param name="form">Zu versteckende Form </param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Hide(ByVal form As Form) As Boolean
Try
form.Capture =
True
Dim hWnd As IntPtr = GetCapture()
form.Capture =
False
SHFullScreen(hWnd, SHFS_HIDETASKBAR
Or SHFS_HIDESIPBUTTON Or SHFS_HIDESTARTICON)
SetWindowPos(hWnd, IntPtr.Zero, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, SWP_NOZORDER)
Return True
Catch ex As Exception
Return False
End Try
End Function
End
Class
Es kann vokommen, dass das Menü am unteren Bildschirmrand nicht verschwindet, dieses kann man aber im Designer direkt ausdokumentieren:
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
'Me.mainMenu1 = New System.Windows.Forms.MainMenu
Me.SuspendLayout()
'Form2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
Me.AutoScroll = True
Me.ClientSize = New System.Drawing.Size(240, 294)
Me.Location = New System.Drawing.Point(0, 0)
' Me.Menu = Me.mainMenu1
Me.Name = "Form2"
Me.Text = "Form2"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
Me.ResumeLayout(False)
End Sub