隐藏在Vista / Win 7的启动球在C# [英] Hide Start Orb on Vista / Win 7 in C#
问题描述
当躲在Vista和Windows 7的开始按钮(也称为启动ORB)任务栏没有得到隐患。我一直在寻找一个解决方案,这一点,我发现之一,但不是必要的它似乎更加复杂。
这 $ C $的CProject文章介绍(并包含code表示),您列举的所有线程的所有子窗口中包含开始菜单中的程序的解决方案。
有没有人发现了一个简单的解决方案?
仅供参考。在code为隐藏任务栏(没有隐藏ORB)如下。首先做必要的Win32进口和声明。
函数[DllImport(user32.dll中)]
私人静态外部的IntPtr FindWindow函数(字符串的className,串windowText);函数[DllImport(user32.dll中)]
私人静态外部INT的ShowWindow(IntPtr的HWND,INT命令);
私人const int的SW_HIDE = 0;
私人const int的SW_SHOW = 1;
然后,在某个地方的方法,叫他们用正确的参数
IntPtr的hwndTaskBar = FindWindow函数(Shell_TrayWnd,);
的ShowWindow(this.hwndTaskBar,SW_HIDE);
我能够放在一起并不需要所有的线程枚举的解决方案。以下是相关部分。
如果您声明 FindWindowEx
如下:
函数[DllImport(user32.dll中)]
私人静态外部的IntPtr FindWindowEx(
IntPtr的parentHwnd,
IntPtr的childAfterHwnd,
IntPtr的类名,
串windowText);
您可以再访问窗口句柄启动球是这样的:
IntPtr的hwndOrb = FindWindowEx(IntPtr.Zero,IntPtr.Zero,(IntPtr的)0xC017,NULL);
和禁用启动球是这样的:
的ShowWindow(hwndOrb,SW_HIDE);
这种方法的关键是,我们使用的IntPtr
键入的className变量,而不是一个字符串 FindWindowEx
功能。这使我们能够使用需要一个 ATOM
类型,而不是字符串
在此功能的一部分。我能够分辨特定 ATOM
来使用的是 0xC017
从这个职位:
<一href=\"http://social.msdn.microsoft.com/forums/en-US/windowsgeneraldevelopmentissues/thread/0c129cb1-ca14-4991-b76e-f80ee308dd87\">Hide Vista开始宝珠
希望这会简化版本可以帮助一些人。
更新:
我创造了这个新 code项目页面记录了这一过程。
When hiding the Task Bar on Vista and Windows 7 the Start Button (also known as the Start Orb) doesn't get hidden. I've been looking for a solution to this and I've found one but it seems more complex than necessary. This CodeProject article describes (and contains code for) a solution where you enumerate all child windows of all threads in the process that contains the start menu.
Has anyone found a simpler solution?
Just for reference. The code for hiding the Task Bar (without hiding the Orb) is as follows. First do the necessary Win32 imports and declarations.
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string className, string windowText);
[DllImport("user32.dll")]
private static extern int ShowWindow(IntPtr hwnd, int command);
private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
Then, in a method somewhere, call them with the right arguments
IntPtr hwndTaskBar = FindWindow("Shell_TrayWnd", "");
ShowWindow(this.hwndTaskBar, SW_HIDE);
I was able to put together a solution that didn't require all the thread enumeration. Here are the relevant parts.
If you declare FindWindowEx
as follows
[DllImport("user32.dll")]
private static extern IntPtr FindWindowEx(
IntPtr parentHwnd,
IntPtr childAfterHwnd,
IntPtr className,
string windowText);
You can then access the window handle for the Start Orb like this:
IntPtr hwndOrb = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null);
and disable the Start Orb like this:
ShowWindow(hwndOrb, SW_HIDE);
The key to this method is that we use the IntPtr
type for the className variable instead of a string in the FindWindowEx
function. This allows us to use the portion of this function that takes an ATOM
type rather than a string
. I was able to discern that the particular ATOM
to use is at 0xC017
from this post:
Hide Vista Start Orb
Hope this simplified version helps some people.
UPDATE: I created this new Code Project Page to document this process.
这篇关于隐藏在Vista / Win 7的启动球在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!