I think you can send the win32AI message "WM_CLOSE" when the button is clicked like a function in win32 SDK "SendMessage()" function: like this: // define [DllImport("User32.dll")] public static extern IntPtr FindWindow(String lpClassName, String lpWindowName); [DllImport("User32.dll")] static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); const int WM_LBUTTONDOWN = 0x201; const int WM_LBUTTONUP = 0x0202; // sample, u should use spy++ to find windows class name and control class name IntPtr hwndWin = FindWindow("TfrmMain", "window title"); if (hwndWin.Equals(IntPtr.Zero) == false) { IntPtr hwndBtn = FindWindowEx(hwndWin, IntPtr.Zero, "TButton", "control text"); if (hwndBtn.Equals(IntPtr.Zero) == false) { SendMessage(hwndBtn, WM_LBUTTONDOWN, IntPtr.Zero, IntPtr.Zero); SendMessage(hwndBtn, WM_LBUTTONUP, IntPtr.Zero, IntPtr.Zero); } }
Q
qingfengliuyue
@qingfengliuyue
Posts
-
FormClosingEvent -
publish problem with C# express 2005I have the same question like you, I can't make my c# application,to a package contains pic and some xml files config for my application! I suggest you use other tools package your application Because Only the visual studio.NET can do this.