C# hide sip

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 SHFullScreenHelpe

private const Int32 SHFS_SHOWSIPBUTTON = 0x0004
private const Int32 SHFS_HIDESIPBUTTON = 0x0008
private const Int32 SHFS_SHOWSTARTICON = 0x0010
private const Int32 SHFS_HIDESTARTICON = 0x0020

#define SHFS_SHOWTASKBAR            0x0001
#define SHFS_HIDETASKBAR            0x0002
#define SHFS_SHOWSIPBUTTON          0x0004
#define SHFS_HIDESIPBUTTON          0x0008
#define SHFS_SHOWSTARTICON          0x0010
#define 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)
}

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 butto
SHFullScreenHelper.ShowStartButton(this, true); //This shows the Start butto

SHFullScreenHelper.ShowStartButton(Me, False) 'This hides the Start button (VB
SHFullScreenHelper.ShowStartButton(Me, True) 'This shows the Start button (VB
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值