Hide Start Orb on Vista / Win 7 in C#

你说的曾经没有我的故事 提交于 2019-11-27 23:08:24

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!