Ejemplo n.º 1
0
        /// <summary>
        /// 重写WndProc函数,类型为虚保护,响应窗体消息事件
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="msg">消息内容</param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <param name="handled">是否相应完成</param>
        /// <returns></returns>
        protected virtual IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            const int WM_HOTKEY = 0x0312;//如果m.Msg的值为0x0312那么表示用户按下了热键

            if (msg == WM_HOTKEY)
            {
                if (Var.bLogin)
                {
                    switch (wParam.ToInt32())
                    {
                    case 104:        //按下的是F6
                        this.WindowState = System.Windows.WindowState.Minimized;
                        break;

                    case 102:        //按下的是F4
                        Var.PayChannel = 2;
                        if (Var.bAlreadyOpen == false)
                        {
                            Var.bAlreadyOpen = true;
                            PayWindow pay = new PayWindow();
                            pay.ShowDialog();
                            Var.bAlreadyOpen = false;
                        }
                        break;

                    case 101:        //按下的是F3
                        Var.PayChannel = 1;
                        if (Var.bAlreadyOpen == false)
                        {
                            Var.bAlreadyOpen = true;
                            PayWindow pay = new PayWindow();
                            pay.ShowDialog();
                            Var.bAlreadyOpen = false;
                        }
                        break;

                    case 105:
                        if (Var.bAlreadyOpen == false)
                        {
                            Var.bAlreadyOpen = true;

                            SetAmountPosition win = new SetAmountPosition();
                            if (!win.IsVisible)
                            {
                                win.ShowDialog();
                            }
                            else
                            {
                                win.Activate();
                            }

                            Var.bAlreadyOpen = false;
                        }
                        break;
                    }
                }
            }

            return(IntPtr.Zero);
        }
Ejemplo n.º 2
0
        private void btPosition_Click(object sender, RoutedEventArgs e)
        {
            //ParmIni.IniWriteValue("CaptureScreen", "Left", tBoxCaptureScreen_Left.Text);
            //ParmIni.IniWriteValue("CaptureScreen", "Top", tBoxCaptureScreen_Top.Text);
            //ParmIni.IniWriteValue("CaptureScreen", "Width", tBoxCaptureScreen_Width.Text);
            //ParmIni.IniWriteValue("CaptureScreen", "Height", tBoxCaptureScreen_Height.Text);

            SetAmountPosition win = new SetAmountPosition();

            if (!win.IsVisible)
            {
                win.ShowDialog();
            }
            else
            {
                win.Activate();
            }
        }