Hi, massimo
I found this code posted to the newsgroups in August. It looks to be exactly what you need.
-- Begin Code --
// SHFullScreenHelper.cs
// Posted by Jim Wilson on microsoft.public.dotnet.framework.compactframework
// on August 12, 2003.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Text;
namespace TestApp
{
/// <summary>
/// Provides an interface to hide and show the SIP, SIP button, and the Start button.
/// </summary>
public class SHFullScreenHelper
{
private const Int32 SHFS_SHOWSIPBUTTON = 0x0004;
private const Int32 SHFS_HIDESIPBUTTON = 0x0008;
private const Int32 SHFS_SHOWSTARTICON = 0x0010;
private const Int32 SHFS_HIDESTARTICON = 0x0020;
private const string formWindowClassName = "#NETCF_AGL_BASE_" ;
[DllImport("aygshell.dll")]
private static extern Int32 SHFullScreen(IntPtr hWnd, Int32 dwState) ;
[DllImport("coredll.dll")]
private static extern IntPtr FindWindow(string className, string windowName) ;
[DllImport("coredll.dll")]
private static extern Int32 GetClassName(IntPtr hWnd, StringBuilder className, int maxCount) ;
public static bool ShowStartIcon(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSTARTICON : SHFS_HIDESTARTICON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}
public static bool ShowSIPButton(Form f, bool bShow)
{
Int32 dwFlag = bShow ? SHFS_SHOWSIPBUTTON : SHFS_HIDESIPBUTTON ;
return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
}
private static IntPtr GetWindowHandle(Form f)
{
return FindWindow(formWindowClassName, f.Text);
}
}
}
-- End Code --
To use it, just create a class file and drop in the code. Then, call the function as follows:
SHFullScreenHelper.ShowSIPButton(this, false); //This hides the SIP button (C#)
SHFullScreenHelper.ShowSIPButton(this, true); //This displays the SIP button (C#)
SHFullScreenHelper.ShowSIPButton(Me, False) 'This hides the SIP button (VB)
SHFullScreenHelper.ShowSIPButton(Me, True) 'This shows the SIP button (VB)
You can also show and hide the Start menu button as follows:
SHFullScreenHelper.ShowStartButton(this, false); //This hides the Start button
SHFullScreenHelper.ShowStartButton(this, true); //This shows the Start button
SHFullScreenHelper.ShowStartButton(Me, False) 'This hides the Start button (VB)
SHFullScreenHelper.ShowStartButton(Me, True) 'This shows the Start button (VB)
Hope this helps =)
Flynn
----- massimo capetola wrote: -----
I would like to make invisible the SIP button in my VB.net project, here is
what I do on load event of the form "frmToto"
Dim hWnd As IntPtr = FindWindow(Nothing, "frmToto")
RC = SHFullScreen(hWnd, SHFS_HIDESIPBUTTON)
The "SHFullScreen" return True, but my SIP button is still visible.
What is wrong in my code?
my API declaration:
Public Declare Function SHFullScreen Lib "aygshell" (ByVal hwndRequester As
IntPtr, ByVal dwState As Integer) As Boolean
Public Declare Function FindWindow Lib "Coredll" Alias "FindWindowW" (ByVal
lpClassName As String, ByVal lpWindowName As String) As IntPtr