private void MouseOperate(object obj)
        {
            if (!m_bInitialized)
            {
                int nReturn = KeyboardMouseSimulateDriverAPI.Initialize((uint)m_nSimulateWay);
                m_bInitialized = (0 == nReturn);
                ShowInfoBoard("Initialize", nReturn, m_bInitialized);
                System.Threading.Thread.Sleep(1000);
            }

            ShowInfoBoard("Ready...");
            System.Threading.Thread.Sleep(1000);
            ShowInfoBoard("Go ! ! !");
            System.Threading.Thread.Sleep(1000);

            if (m_bInitialized)
            {
                bool       bResult     = false;
                Parameters stParameter = (Parameters)obj;

                if (KeyboardMouseSimulatorDemo.MouseButtons.LeftDown == (KeyboardMouseSimulatorDemo.MouseButtons.LeftDown & stParameter.m_nMouseButtons))
                {
                    bResult  = KeyboardMouseSimulateDriverAPI.MouseDown((uint)KeyboardMouseSimulatorDemo.MouseButtons.LeftDown);
                    bResult &= KeyboardMouseSimulateDriverAPI.MouseUp((uint)KeyboardMouseSimulatorDemo.MouseButtons.LeftUp);

                    ShowInfoBoard(KeyboardMouseSimulatorDemo.MouseButtons.LeftDown, bResult);
                }
                else if (KeyboardMouseSimulatorDemo.MouseButtons.RightDown == (KeyboardMouseSimulatorDemo.MouseButtons.RightDown & stParameter.m_nMouseButtons))
                {
                    bResult  = KeyboardMouseSimulateDriverAPI.MouseDown((uint)KeyboardMouseSimulatorDemo.MouseButtons.RightDown);
                    bResult &= KeyboardMouseSimulateDriverAPI.MouseUp((uint)KeyboardMouseSimulatorDemo.MouseButtons.RightUp);

                    ShowInfoBoard(KeyboardMouseSimulatorDemo.MouseButtons.RightDown, bResult);
                }
                else //Move Checked
                {
                    if (chkbxAbsolute.Checked)
                    {
                        bResult = KeyboardMouseSimulateDriverAPI.MouseMove(stParameter.m_nCursorPositionX, stParameter.m_nCursorPositionY, true);
                    }
                    else if (chkbxRelative.Checked)
                    {
                        bResult = KeyboardMouseSimulateDriverAPI.MouseMove(stParameter.m_nCursorPositionX, stParameter.m_nCursorPositionY, false);
                    }

                    ShowInfoBoard(KeyboardMouseSimulatorDemo.MouseButtons.Move, bResult);
                }
            }

            ButtonControl(btnMouseOperate, true, "Mouse");
        }
        private void Simulate(object obj)
        {
            if (!m_bInitialized)
            {
                int nReturn = KeyboardMouseSimulateDriverAPI.Initialize((uint)m_nSimulateWay);
                m_bInitialized = (0 == nReturn);
                ShowInfoBoard("Initialize", nReturn, m_bInitialized);
                System.Threading.Thread.Sleep(1000);
            }

            ShowInfoBoard("Ready...");
            System.Threading.Thread.Sleep(1000);
            ShowInfoBoard("Go ! ! !");
            System.Threading.Thread.Sleep(1000);

            if (m_bInitialized)
            {
                Parameters stParameter = (Parameters)obj;
                for (int i = 0; i < stParameter.m_nPeriod; i++)
                {
                    int      nTimes  = 1;
                    DateTime dtStart = DateTime.Now;
                    while (stParameter.m_nDuration > (DateTime.Now - dtStart).TotalSeconds)
                    {
                        ShowInfoBoard(nTimes, KeyboardMouseSimulateDriverAPI.KeyDown(stParameter.m_nKeyCode));
                        ShowInfoBoard(nTimes++, KeyboardMouseSimulateDriverAPI.KeyUp(stParameter.m_nKeyCode));

                        if (0 < stParameter.m_nInterval)
                        {
                            System.Threading.Thread.Sleep(stParameter.m_nInterval);
                        }
                    }
                }
            }

            ButtonControl(btnSimulate, true, "Simulate");
        }