0

Code:

    [DllImport("AYGShell.dll")]
    static extern Int32 SHFullScreen(IntPtr hwndRequester, UInt32 dwState);

    public const UInt32 SHFS_SHOWSIPBUTTON = 0x0004;
    public const UInt32 SHFS_HIDESIPBUTTON = 0x0008;

    public Form1()
    {
        InitializeComponent();
    }

    private void OnPaint(object sender, PaintEventArgs e)
    {
        HideSipButton();
    }

    private void HideSipButton()
    {
        UInt32 dwState = SHFS_HIDESIPBUTTON;//: SHFS_SHOWSIPBUTTON;
        SHFullScreen(this.Handle, dwState);
    }

HI, above code works fine in the first launch of a form in windowsmobile, it hides the sip button of a form in windows mobile, but if i click on the menu bar sip-button reappears.. i dont no how to eliminate the sip button completely.. please help me how to fix this..

i ment i dont want sip button at all for a form in windowsmobile.. i am using .net CF

Thanks

Moayad Mardini
  • 7,271
  • 5
  • 41
  • 58
Naruto
  • 9,476
  • 37
  • 118
  • 201
  • did you see this http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.inputpanel%28VS.85%29.aspx? and this question (not sure it will help you): http://stackoverflow.com/questions/323874/how-to-show-hide-sip-on-pocket-pc – Shaihi Sep 30 '09 at 15:11
  • thanks, i wil try, but am not using any panel here.its a default panel . there might be simple technique to hide.. so i am searching. – Naruto Sep 30 '09 at 15:17

2 Answers2

1

When you say you click on the "menu bar" are you talking about a custom bar you've written or the standard bar (the one with the start menu, clock, etc.) at the top of all programs (except full screen ones)?

If you're talking about the normal start menu bar, when you click on it your program is no longer the active one, which is why the SIP button is redrawn. If that's the case you may be able to use the Activated event to try to hide the SIP button again.

Extra note: This code will only re-hide the SIP button when the user clicks in your form again, it will not run until that happens.

Here's an idea on what I'm describing:

public Form1()
{
  InitializeComponent();
  this.Activated += new EventHandler(Form1_Activated);
}

private void Form1_Activated(object sender, EventArgs e)
{
  HideSipButton();
}

private void OnPaint(object sender, PaintEventArgs e)
{
  HideSipButton();
}
Joshua
  • 8,112
  • 3
  • 35
  • 40
  • Hey it works.. only in first instance.. and if i click first SIP button appears, then if i click over SIP button it will call paint event, then again it will be hidden.. when i click on the Menubar neither form activate nor paint event will not come. – Naruto Sep 30 '09 at 15:29
0

Override the Form.OnActivated method and call HideSipButton. E.x.:

protected override void OnActivated(EventArgs e)
{
  HideSipButton();
  return base.Equals(e);
}
Hasani Blackwell
  • 2,026
  • 1
  • 13
  • 10
  • Why override it when you can just attach to the event? – Joshua Sep 30 '09 at 15:21
  • From the 'Remarks' section. "The OnActivated method also allows derived classes to handle the event without attaching a delegate. Overriding this method is the preferred technique for handling the event in a derived class." - http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onactivated.aspx – Hasani Blackwell Sep 30 '09 at 16:26
  • Interesting, I did not know that. – Joshua Sep 30 '09 at 17:36