none
Hide SIP button on WM 6.5.3

    Question

  • Hi,

     

    I can hide a SIP button on WM 6, but the same code does not work for WM 6.5.3 .

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
          SHFullScreen(this.Handle, SHFS_HIDESIPBUTTON);
        }

    I tried out lot of tricks, e.g.:

    // 1. Set window's position by:

    SetWindowPos(..)

    // 2. way

    // Turn off Button
    MoveWindow(FindWindow("MS_SIPBUTTON", null), 219, 295, 0, 0, 1);
    ShowWindow(FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON"), 0);

    Is there a way to hide the SIP button for 6.5.3 ?

    Thanks in advance!

    Best regards,

    Viktor

    Wednesday, October 20, 2010 9:11 AM

Answers

  • Hi Viktor,

     

    Did some experimentation: This seems to work:

     

    [DllImport("coredll.dll", SetLastError = true)]
        public static extern IntPtr FindWindow(string caption, string className);
    
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern bool ShowWindow(IntPtr hwnd, int state);
    
        private const int SW_HIDE = 0;
        private const int SW_SHOW = 1;
    
        [DllImport("coredll.dll")]
        private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
    
        private void button1_Click(object sender, EventArgs e)
        {
          HideIt();
        }
    
        private void HideIt()
        {
          IntPtr hSipWindow = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
          if (hSipWindow != IntPtr.Zero)
          {
            IntPtr hSipButton = GetWindow(hSipWindow, 5);
            if (hSipButton != IntPtr.Zero)
            {
              bool res = ShowWindow(hSipButton, SW_HIDE);
            }
          }
        }
    

    dh

    Friday, November 05, 2010 11:19 AM

All replies

  • I use the InputPanel from Microsoft.WindowsCE.Forms.dll That lets you have a lot of control of the SIP without dealing with P/Invokes.
    Wednesday, October 20, 2010 8:31 PM
  • Hi Viktor,

    Do you test it on other WM6.5.3 device, is it your device issue? Do you test it on WM6.5 emulator?

     

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, October 22, 2010 7:01 AM
  • Hi Guang-Ming,

     

    The next code works properly on WM6.5 emulator:

      private void Form1_Paint(object sender, PaintEventArgs e)
    {
    SHFullScreen(this.Handle, SHFS_HIDESIPBUTTON);
    }

    I've tried out on WM6.5.3, but there remains visible the SIP button.

    I also tried some tricks on WM6.5.3 device, but with no success.

     

    Friday, October 22, 2010 7:37 AM
  • Hi IowaEric,

    thanks for your reply.

    I'm know of that control, but that does not allows you to hide the SIP button. Or do you know a way to hide the SIP button from the bottom menu bar on WM 6.5.3 platform?

    Thanks in advance for your suggestions!

     

    Best regards,

    Viktor

    Friday, October 22, 2010 8:09 AM
  • Hi viktor,

    As we know, SHFullScreen API will hide SIP in WM platform. It should your device issue, I suggest you contact with OEM for help.

     

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, October 26, 2010 5:03 AM
  • Hi Guang-Ming,

    It does not work on the emulator 6.5.3 as well.

    Did you try it out? I can send you my sample code if you want.

    Thanks for your support!

     

    Best regards,

    Viktor

     

     

    Tuesday, October 26, 2010 8:03 AM
  • Hi Viktor,

     

    Not sure if you have resolved this but certainly in c++ project, the only way I have got this working consistently (Which I admit is not a very elegant solution but works). Is to actually search for the SIP Button window and hide that - as in:

     

    	CWnd* SipPanel = FindWindow( L"SipWndClass", NULL );
    	if (SipPanel)
    		SipPanel->ShowWindow(SW_HIDE);
    
    	CWnd* SipButton = FindWindow( L"MS_SIPBUTTON", NULL );
    	if (SipButton)
    		SipButton->ShowWindow(SW_HIDE);
    

    Hope this helps

    dh 

    Thursday, October 28, 2010 11:31 AM
  • Hi dh,

    thanks for your code. It work fine on WM6, but not on WM6.5.3 emulator. :(

    I've converted your native code, and tried out in managed code:

     

     public partial class Form3 : Form
      {
        public Form3()
        {
          InitializeComponent();
        }
    
        [DllImport("Coredll.dll")]
        public static extern IntPtr FindWindow(string caption, string className);
    
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern bool ShowWindow(IntPtr hwnd, int state);
    
        private const int SW_HIDE = 0x0000;
        private const int SW_SHOW = 0x0001;
    
        [System.Runtime.InteropServices.DllImport("AYGShell.dll")]
        static extern Int32 SHFullScreen(IntPtr hwndRequester, UInt32 dwState);
    
        public const UInt32 SHFS_SHOWTASKBAR = 0x0001;
        public const UInt32 SHFS_HIDETASKBAR = 0x0002;
    
        public const UInt32 SHFS_SHOWSIPBUTTON = 0x0004;
        public const UInt32 SHFS_HIDESIPBUTTON = 0x0008;
    
        public const UInt32 SHFS_SHOWSTARTICON = 0x0010;
        public const UInt32 SHFS_HIDESTARTICON = 0x0020;
    
    
        private IntPtr hSip;
        private IntPtr hSipButton;
    
        private void button1_Click(object sender, EventArgs e)
        {
          hSip = FindWindow("SipWndClass", null);
          if (!IntPtr.Zero.Equals(hSip))
          {
            bool result = ShowWindow(hSip, SW_HIDE);
          }
    
          hSipButton = FindWindow("MS_SIPBUTTON", null);
          if (!IntPtr.Zero.Equals(hSipButton))
          {
            bool result = ShowWindow(hSipButton, SW_HIDE);
          }
    
        }
    
        private void mnuExit_Click(object sender, EventArgs e)
        {
          this.Close();
        }
      }
    

     Does your code work properly on WM 6.5.3?

    Thanks in advace for your help!

     

    Best regards,

    Viktor

    Sunday, October 31, 2010 12:53 PM
  • Viktor,

     

    Yes, I use this code in my app, in addition I use some other calls, see below for the method:

     

    void CWADialog::Fullscreen()
    {
    	SHSipPreference(this->m_hWnd,SIP_DOWN);
    	SHSipPreference(this->m_hWnd,SIP_FORCEDOWN);
    	SHFullScreen(this->m_hWnd, SHFS_HIDESIPBUTTON);
    	SHFullScreen(this->m_hWnd, SHFS_HIDETASKBAR);
    	
    	CWnd* SipPanel = FindWindow( L"SipWndClass", NULL );
    	if (SipPanel)
    		SipPanel->ShowWindow(SW_HIDE);
    
    	CWnd* SipButton = FindWindow( L"MS_SIPBUTTON", NULL );
    	if (SipButton)
    		SipButton->ShowWindow(SW_HIDE);
    }
    
    void CWADialog::NonFullscreen()
    {
    	CWnd* Taskbar = FindWindow( L"HHTaskbar", NULL );
    	if (Taskbar)
    		Taskbar->ShowWindow(SW_SHOW);
    
    	CWnd* SipButton = FindWindow( L"MS_SIPBUTTON", NULL );
    	if (SipButton)
    		SipButton->ShowWindow(SW_SHOW);
    
    	SHSipPreference(this->m_hWnd,SIP_DOWN);
    	SHSipPreference(this->m_hWnd,SIP_FORCEDOWN);
    	SHFullScreen(this->m_hWnd, SHFS_SHOWSTARTICON);
    	SHFullScreen(this->m_hWnd, SHFS_SHOWTASKBAR);
    }
    

    This works on 6.5.3 emulator but not tried it on a device yet.

    Hope it helps.

    dh

    Monday, November 01, 2010 8:54 AM
  • Hi dh,

     

    thanks for your answer.

     

    Still does not work for me in managed code. :(

    When do you call your Fullscreen() function? In constructor of your Form, or in other event handler (e.g. Load, Paint, Activate)?

    I run that code on button's click event handler.

    I will try to create a native dll, maybe it helps.

     

    Thanks for your cooperation!

     

    Best regards,

    Viktor

    Friday, November 05, 2010 6:57 AM
  • Hi Viktor,

     

    In answer to your question, I use it in both the "OnInitDialog" (last call after initializing) to initially hide it and also in the "OnActivate" event handler.

    As every time the form is activated (or child control) the sip button seems to re-appear.

    This is probably why it does not appear to work on yours. Does the Click event you use do anything else? It may be that once clicked your form then again receive a activate message and therefore shows the button again. My first thought would be to try adding an OnActivate event handler and call your hide method from there.

     

    If I gett a chance today Ill try replicate in c# and post my findings. 

     

    Event Handlers below:

    BOOL Template::OnInitDialog()
    {
    	CWADialog::OnInitDialog();
    
      // Initialization code goes here
    
    
      Fullscreen();
    };
    
    void Template::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
    {
    	CDialog::OnActivate(nState, pWndOther, bMinimized);
    
    	if (nState != WA_INACTIVE)
    	{
    		Fullscreen();
    	}
    	else
    	{
    		NonFullscreen();
    	}
    };
    

     

    Hope this helps solve your issue.

     

    dh

    Friday, November 05, 2010 8:21 AM
  • Hi Viktor,

     

    Did some experimentation: This seems to work:

     

    [DllImport("coredll.dll", SetLastError = true)]
        public static extern IntPtr FindWindow(string caption, string className);
    
        [DllImport("coredll.dll", SetLastError = true)]
        public static extern bool ShowWindow(IntPtr hwnd, int state);
    
        private const int SW_HIDE = 0;
        private const int SW_SHOW = 1;
    
        [DllImport("coredll.dll")]
        private static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
    
        private void button1_Click(object sender, EventArgs e)
        {
          HideIt();
        }
    
        private void HideIt()
        {
          IntPtr hSipWindow = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
          if (hSipWindow != IntPtr.Zero)
          {
            IntPtr hSipButton = GetWindow(hSipWindow, 5);
            if (hSipButton != IntPtr.Zero)
            {
              bool res = ShowWindow(hSipButton, SW_HIDE);
            }
          }
        }
    

    dh

    Friday, November 05, 2010 11:19 AM
  • Hi dh,

     

    thank you very much, it works properly!

    Excellent work!

     

    Best regards,

    Viktor

     

     

    Monday, November 08, 2010 8:05 AM