Hiding the SIP Button

R

Ron Weiner

I have been having lots of fun for the last couple days trying to eradicate
the SIP button from my Pocket PC 2003SE application. I have several forms
in the application that have to have Menu bars. Part of the baggage that
(apparently) that one gets when one needs a Menu bar is the SIP button comes
along for the ride. I am using code like this (found everywhere in Google
searches) to make the SIP button disappear.

Capture = True
Dim hWnd As IntPtr = GetCapture()
Capture = False
ShowHideScreenElements(hWnd, SHFS_HIDESIPBUTTON)

I discovered, after MUCH trial and error, that I needed to place this code
the Form Load, Form Activate, and OnPaint Override events of the forms with
Menu bars. I also discovered when switching back to my form with a Menu
bar, from any other form, would cause the SIP button to reappear. I
discovered when coming back from another form, and the SIP button was
visible again, that taping on and releasing any menu item would cause the
SIP Button to disappear. AhHAa... A clue! So I started looking for a way
to dirty (?) the Menu bar in the FromActivate event. This is what I came up
with:

' Create, Display and Destroy a fake menu that dirty's the Menu Bar
Dim FakeMenu As New MenuItem
FakeMenu.Text = " "
Me.Menu.MenuItems.Add(FakeMenu)
Application.DoEvents()
Me.Menu.MenuItems.Remove(FakeMenu)
' Hide the Start Button every time the form is activated
Capture = True
Dim hWnd As IntPtr = GetCapture()
Capture = False
ShowHideScreenElements(hWnd, SHFS_HIDESIPBUTTON)

Believe it or not all of this actually WORKS! However I can't believe that
this is the best way to do it. Often times there is a noticeable flicker of
the SIP Button as the form repaints itself, probably caused by the DoEvents
line. Remove the DoEvents and the SIP button does not disappear. Does
anyone have a better way to Dirty (?) the Menu bar, or am I missing
something?
 
R

Rick

If you never want to see the SIP you can do this in your form's Activated
sub:

Private Sub MainForm_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated

Dim hWnd As IntPtr = FindWindow(Nothing, "MS_SIPBUTTON") ' Name of the
SIP button window

SetWindowPos(hWnd, SetWindowPosZOrder.HWND_BOTTOM, 0, 0, 0, 0,
SetWindowPosFlags.SWP_HIDEWINDOW)

End Sub
 
G

Guest

Rick,

Is 'FindWindow' a C# function? I'm using VB.NET and don't seem to have
access to it. Same with SetWindowPos.

Thanks.

Kent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top