使用API函数发送消息关闭程序:WM_CLOSE=0x0010;

来源:互联网 发布:linux上新建weblogic域 编辑:程序博客网 时间:2024/06/06 19:09
        private void button1_Click(object sender, EventArgs e)        {            //使用API函数发送消息关闭程序:WM_CLOSE=0x0010;            SendMessage(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, 0x0010, 0, 0);        }        [System.Runtime.InteropServices.DllImport("user32")]        private static extern Int16 SendMessage(IntPtr hWnd, Int16 Msg, Int16 wParam, Int16 lParam);

0 0