DllImport

[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

 

[DllImport(
"user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

 

[DllImport(
"user32.dll")]
private static extern bool SetCursorPos(int X, int Y);


[DllImport(
"user32.dll", EntryPoint = "mouse_event")]
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

 

[DllImport(
"user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);

 

IntPtr hwnd 
= FindWindow(null"Microsoft Excel");
ShowWindow(hwnd, 
3);
SetForegroundWindow(hwnd);
SetCursorPos(
500300);
mouse_event(
60000);

 

 

posted on 2010-07-26 14:15  arbin98  阅读(432)  评论(1编辑  收藏  举报