[WM][VB][把開始功能表的微軟國旗隱藏起來]

  • 4890
  • 0

[WM][VB][把開始功能表的微軟國旗隱藏起來]

很多人在做專案的時候都會碰到應用程式叫起來後,使用者會亂點功能表啟動不必要的應用程式,所以我們要如何防止這項事件發生呢,.netCF也沒提供任何的api 所以我們在次的要使用外部檔案COREDLL.DLL

                    開始還在                                                     開始不在

image      image

 

根據上面的圖片顯示可使用下列此段程式碼在達成

Private Const SHFS_SHOWSTARTICON As Integer = &H10
  Private Const SHFS_HIDESTARTICON As Integer = &H20
  Private Const formWindowClassName As String = "#NETCF_AGL_BASE_"
  Declare Function SHFullScreen Lib "AYGSHELL.DLL" (ByVal hWnd As IntPtr, ByVal dwState As Int32) As Integer
  Declare Function FindWindow Lib "COREDLL.DLL" (ByVal className As String, ByVal windowName As String) As IntPtr
  Private Function GetWindowHandle(ByVal frm As Form) As IntPtr
      Return FindWindow(formWindowClassName, frm.Text)
  End Function

  Public Function ShowStartIcon(ByVal frm As Form, ByVal bShow As Boolean) As Boolean
      Dim dwFlag As Int32 = IIf(bShow, SHFS_SHOWSTARTICON, SHFS_HIDESTARTICON)
      Return SHFullScreen(GetWindowHandle(frm), dwFlag) <> 0
  End Function

如何使用 ShowStartIcon(目前的表單,顯示的話就是True),就二個參數輸入可以立即見效。