Example #1
0
 public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, int lcid)
 {
     return(Show(WindowsAPI.GetActiveWindow(), text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, lcid));
 }
Example #2
0
 public static DialogResult Show(string text)
 {
     return(Show(WindowsAPI.GetActiveWindow(), text, "", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, _defaultLCID));
 }
Example #3
0
 public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
 {
     return(Show(WindowsAPI.GetActiveWindow(), text, caption, buttons, icon, defaultButton, _defaultLCID));
 }
Example #4
0
 public static DialogResult Show(IntPtr handle, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, int lcid)
 {
     return((DialogResult)WindowsAPI.MessageBoxEx(handle, text, caption, (int)buttons | (int)defaultButton, lcid));
 }
Example #5
0
 /// <summary>
 /// 设置父容器
 /// </summary>
 /// <param name="parentHandle"></param>
 /// <param name="childHandle"></param>
 private static void SetParent(IntPtr parentHandle, IntPtr childHandle)
 {
     WindowsAPI.SetParent(childHandle, parentHandle);
 }
Example #6
0
        // ************************************************************************

        // ************************************************************************
        // Install the hook
        public void Install()
        {
            if (m_hhook != IntPtr.Zero)
            {
                throw new Exception("钩子已经启动");
            }
            using (Process curProcess = Process.GetCurrentProcess())
                using (ProcessModule curModule = curProcess.MainModule)
                {
                    m_hhook = WindowsAPI.SetWindowsHookEx((int)m_hookType, m_filterFunc, WindowsAPI.GetModuleHandle(curModule.ModuleName), 0);
                }
            //m_hhook = WindowsAPI.SetWindowsHookEx(
            //    (int)m_hookType,
            //    m_filterFunc,
            //    IntPtr.Zero,
            //    (int)Thread.CurrentThread.ManagedThreadId);
            if (m_hhook == IntPtr.Zero)
            {
                throw new Exception("挂钩失败");
            }
        }
Example #7
0
        /// <summary>
        /// 关闭进程
        /// </summary>
        /// <param name="id"></param>
        public static void KillProcess(int id)
        {
            IntPtr hProcess = WindowsAPI.OpenProcess(ProcessAccess.PROCESS_ALL_ACCESS, 0, id);//以所有模式打开进程

            WindowsAPI.TerminateProcess(hProcess, 0);
        }
Example #8
0
 /// <summary>
 /// 刷新注册表
 /// </summary>
 public static void RefreashRegist()
 {
     WindowsAPI.SHChangeNotify(NotifyEvent.SHCNE_ASSOCCHANGED, NotifyEvent.SHCNF_IDLIST, 0, 0);
 }