Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //it might even run
- static void Main(string[] args)
- {
- Int32 lhWndParent = User32.FindWindow(null, "Minesweeper");
- Int32 hMenu = User32.GetMenu(lhWndParent);
- Int32 hViewMenu = User32.GetSubMenu(hMenu, 1);
- Int32 hHelp = User32.GetMenuItemID(hViewMenu, 2);
- User32.SendMessage((IntPtr)lhWndParent, User32.WM_COMMAND, hHelp, null);
- }
- class User32
- {
- [DllImport("user32", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern Int32 FindWindow(string lpClassName, string lpWindowName);
- [DllImport("user32", EntryPoint = "GetMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern Int32 GetMenu(Int32 hwnd);
- [DllImport("user32", EntryPoint = "GetSubMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern Int32 GetSubMenu(Int32 hMenu, Int32 nPos);
- [DllImport("user32", EntryPoint = "GetMenuItemID", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern Int32 GetMenuItemID(Int32 hMenu, Int32 nPos);
- [DllImport("user32")]
- public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, String lParam);
- public const int WM_COMMAND = 273;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement