Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

disable Start menu button

140 views
Skip to first unread message

Harsh Trivedi

unread,
Mar 6, 2007, 9:27:38 AM3/6/07
to
Hi,

We are developing application in VS .NET 2005 + C# + .NET CF 2.0 SP1

My user requirement is ... to disable the Start menu button (Upper left
side, to invoke the start up menu) . This way we can prevent the user to
click on any other program or control panel when our application is running.

Is there a way to achieve this?

Thanks in advance

--
With Best Regards,

Harsh Trivedi


Harsh Trivedi

unread,
Mar 6, 2007, 10:27:10 AM3/6/07
to
Hi,

Hurrey, this worked for me...to disable the start menu...
ShowWindow(FindWindow("HHTaskBar", null), 1); //0=hide, 1=show

On the same track, if anyone can sent source code to set start button as
visible false.... :)

--
With Best Regards,

Harsh Trivedi

"Harsh Trivedi" <harsh....@gatewaytechnolabs.com> wrote in message
news:O3ue1s$XHHA...@TK2MSFTNGP05.phx.gbl...

Paul G. Tobey [eMVP]

unread,
Mar 6, 2007, 11:00:55 AM3/6/07
to
Yes, that's one thing that you'd need to do. You'd also need to disable
that window so Alt+Tab doesn't allow the user to switch applications.
You'll basically have to P/Invoke to those functions (ShowWindow,
FindWindow, EnableWindow), to accomplish this operation.

Paul T.

"Harsh Trivedi" <harsh....@gatewaytechnolabs.com> wrote in message

news:uGFEBOAY...@TK2MSFTNGP04.phx.gbl...

Kay-Christian Wessel

unread,
Mar 6, 2007, 4:25:00 PM3/6/07
to
Here is something I use, which I found on the net some time ago.

Kay

Imports System.Runtime.InteropServices

Public Class BarControl

<DllImport("coredll.dll", EntryPoint:="GetForegroundWindow",
SetLastError:=True)> Private Shared Function GetForegroundWindow() As IntPtr

End Function

<DllImport("aygshell.dll", EntryPoint:="SHFullScreen", SetLastError:=True)>
Private Shared Function SHFullScreen(ByVal hwndRequester As IntPtr, ByVal
dwState As Integer) As Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="EnableWindow")> Private Shared
Function EnableWindow(ByVal hwnd As IntPtr, ByVal bEnable As Boolean) As
Boolean

End Function

<DllImport("coredll.dll", EntryPoint:="FindWindow")> Private Shared Function
FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As
IntPtr

End Function

Private Const SHFS_SHOWSTARTICON As Integer = &H10

Private Const SHFS_HIDESTARTICON As Integer = &H20

Private Const SHFS_HIDESIPBUTTON As Integer = &H8

Private Const SHFS_SHOWSIPBUTTON As Integer = &H4

Private Const SHFS_SHOWTASKBAR As Integer = &H1

Private Const SHFS_HIDETASKBAR As Integer = &H2

Private Shared Function SetTaskBarEnabled(ByVal bEnabled As Boolean) As
Boolean

Dim hwnd As IntPtr = FindWindow("HHTaskBar", Nothing)

If Not hwnd.Equals(IntPtr.Zero) Then

If bEnabled Then

Return EnableWindow(hwnd, True)

Else

Return EnableWindow(hwnd, False)

End If

End If

Return True

End Function

Private Shared Function SetTaskbarVisible(ByVal visible As Boolean) As
Boolean

Dim hwnd As IntPtr = FindWindow("HHTaskBar", Nothing)

If Not hwnd.Equals(IntPtr.Zero) Then

If visible Then

Return SHFullScreen(hwnd, SHFS_SHOWTASKBAR)

Else

Return SHFullScreen(hwnd, SHFS_HIDETASKBAR)

End If

End If

End Function

Private Shared Function SetStartButtonVisible(ByVal visible As Boolean) As
Boolean

Dim hwnd As IntPtr = GetForegroundWindow()

If Not hwnd.Equals(IntPtr.Zero) Then

If visible Then

Return SHFullScreen(hwnd, SHFS_SHOWSTARTICON)

Else

Return SHFullScreen(hwnd, SHFS_HIDESTARTICON)

End If

End If

End Function

Private Shared Function SetSIPVisible(ByVal visible As Boolean) As Boolean

Dim hwnd As IntPtr = GetForegroundWindow()

If Not hwnd.Equals(IntPtr.Zero) Then

If visible Then

Return SHFullScreen(hwnd, SHFS_HIDESIPBUTTON)

Else

Return SHFullScreen(hwnd, SHFS_HIDESIPBUTTON)

End If

End If

End Function

Public Shared Sub ShowTaskBar()

SetTaskBarEnabled(True)

SetTaskbarVisible(True)

End Sub

Public Shared Sub HideTaskBar()

SetTaskbarVisible(False)

SetTaskBarEnabled(False)

End Sub

Public Shared Sub ShowSIP()

SetSIPVisible(True)

End Sub

Public Shared Sub HideSIP()

SetSIPVisible(False)

End Sub

Public Shared Sub HideStartButton()

SetStartButtonVisible(False)

End Sub

Public Shared Sub ShowStartButton()

SetStartButtonVisible(True)

End Sub

End Class


Ian Matthysen

unread,
Mar 19, 2012, 7:19:49 AM3/19/12
to
Hi!
I have tested this code and it works beautifully!

However, it introduces another problem. The mobile app I'm developing needs the built-in camera to take photos. But since the methods in the code segment disables the start menu, taskbar and SIP, it also disables the camera button of the mobile device in the process.

I have tested which of the methods enables and disables the camera as a result, and it turned out to be ShowTaskBar() and HideTaskBar() respectively. Although I can use these methods to enable or disable the camera, this is not an option, since the user must not be able to access the taskbar while my app is running.

My question: Is there a way I can enable ONLY the camera button on the device and disable it again after taking a photo?

Any help will be very much appreciated! Thanks people! :)

Ian (",)

> On Tuesday, March 06, 2007 9:27 AM Harsh Trivedi wrote:

> Hi,
>
> We are developing application in VS .NET 2005 + C# + .NET CF 2.0 SP1
>
> My user requirement is ... to disable the Start menu button (Upper left
> side, to invoke the start up menu) . This way we can prevent the user to
> click on any other program or control panel when our application is running.
>
> Is there a way to achieve this?
>
> Thanks in advance
>
> --
> With Best Regards,
>
> Harsh Trivedi


>> On Tuesday, March 06, 2007 10:27 AM Harsh Trivedi wrote:

>> Hi,
>>
>> Hurrey, this worked for me...to disable the start menu...
>> ShowWindow(FindWindow("HHTaskBar", null), 1); //0=hide, 1=show
>>
>> On the same track, if anyone can sent source code to set start button as
>> visible false.... :)
>>
>> --
>> With Best Regards,
>>
>> Harsh Trivedi
>>
>>
>>
>> "Harsh Trivedi" <harsh....@gatewaytechnolabs.com> wrote in message
>> news:O3ue1s$XHHA...@TK2MSFTNGP05.phx.gbl...


>>> On Tuesday, March 06, 2007 11:00 AM Paul G. Tobey [eMVP] wrote:

>>> Yes, that's one thing that you'd need to do. You'd also need to disable
>>> that window so Alt+Tab doesn't allow the user to switch applications.
>>> You'll basically have to P/Invoke to those functions (ShowWindow,
>>> FindWindow, EnableWindow), to accomplish this operation.
>>>
>>> Paul T.
>>>
>>> "Harsh Trivedi" <harsh....@gatewaytechnolabs.com> wrote in message
>>> news:uGFEBOAY...@TK2MSFTNGP04.phx.gbl...


0 new messages