langsam macht es mich wahnsinnig. Ich möchte gerne in C# via Code den StartButton ausblenden (Windows 7)
Bisher habe ich nicht häufig mit der WinAPI gearbeitet, doch ich dachte das ich die Funktionsweise im groben verstehe.
Kann mir vielleicht jemand helfen?
[DllImport("user32", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern IntPtr GetWindow(IntPtr lpClassName, int lpWindowName); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); private const int GW_CHILD = 5; private const uint WM_CLOSE = 0x10; public bool ShowHideWindowsStartButton() { try { IntPtr hWnd = FindWindow("Shell_traywnd", null); hWnd = GetWindow(hWnd, GW_CHILD); SendMessage(hWnd, WM_CLOSE, 0, 0); return true; } catch (Win32Exception ex) { MessageBox.Show(ex.ToString()); return false; } }
Irgendwie erwische ich den Button nicht, der obige Quellcode killt die Superbar, der Button bleibt aber unangetastet. Weiß zufällig jemand, wie ich an den Handle des Startbuttons komme?
Danke im vorraus,
Sebastian
Dieser Beitrag wurde von web189 bearbeitet: 15. April 2011 - 13:42