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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…