Пример #1
0
 public static void SetEnabled(Control ctrl, bool en)
 {
     if (ctrl.InvokeRequired)
     {
         SetEnabledDelegate del = new SetEnabledDelegate(SetEnabled);
         ctrl.Invoke(del, ctrl, en);
     }
     else
     {
         ctrl.Enabled = en;
     }
 }
Пример #2
0
 private void SetEnabled_numCargaUCP(bool b)
 {
     if (numCargaUCP.InvokeRequired)
     {
         SetEnabledDelegate delegado = new SetEnabledDelegate(SetEnabled_numCargaUCP);
         numCargaUCP.Invoke(delegado, new object[] { b });
     }
     else
     {
         numCargaUCP.Enabled = b;
     }
 }
Пример #3
0
 private void SetEnabled_btCalcular(bool b)
 {
     if (btCalcular.InvokeRequired)
     {
         SetEnabledDelegate delegado = new SetEnabledDelegate(SetEnabled_btCalcular);
         btCalcular.Invoke(delegado, new object[] { b });
     }
     else
     {
         btCalcular.Enabled = b;
     }
 }
 private void SetEnabled(Control tb, bool enabled)
 {
     if (!tb.InvokeRequired)
     {
         tb.Enabled = enabled;
     }
     else
     {
         SetEnabledDelegate de = SetEnabled;
         Invoke(de, tb, enabled);
     }
 }
Пример #5
0
 /// <summary>
 ///     初始化线程安全类
 /// </summary>
 /// <param name="ctrl">需要进行线程安全的控件</param>
 public ThreadSafeSetter(Control ctrl)
 {
     target          = ctrl;
     setText         = SetText;
     setAppendText   = SetAppendText;
     getText         = GetText;
     add             = Add;
     remove          = Remove;
     removeAll       = RemoveAll;
     setEnabled      = SetEnabled;
     getEnabled      = GetEnabled;
     getSelectedItem = GetSelectedItem;
 }
Пример #6
0
        private void LoadSmartMethods()
        {
            IntPtr functionAddress = Kernel32.GetProcAddress(hModule, "exp_getClients");

            GetClients = Marshal.GetDelegateForFunctionPointer <GetClientsDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getAvailablePID");
            GetAvailablePID = Marshal.GetDelegateForFunctionPointer <GetAvailablePIDDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_killClient");
            KillClient      = Marshal.GetDelegateForFunctionPointer <KillClientDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_spawnClient");
            SpawnClient     = Marshal.GetDelegateForFunctionPointer <SpawnClientDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_pairClient");
            PairClient      = Marshal.GetDelegateForFunctionPointer <PairClientDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getClientPID");
            GetClientPID    = Marshal.GetDelegateForFunctionPointer <GetClientPIDDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_freeClient");
            FreeClient      = Marshal.GetDelegateForFunctionPointer <FreeClientDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getImageArray");
            GetImageArray   = Marshal.GetDelegateForFunctionPointer <GetImageArrayDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getDebugArray");
            GetDebugArray   = Marshal.GetDelegateForFunctionPointer <GetDebugArrayDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getRefresh");
            GetRefresh      = Marshal.GetDelegateForFunctionPointer <GetRefreshDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_setRefresh");
            SetRefresh      = Marshal.GetDelegateForFunctionPointer <SetRefreshDelegate>(functionAddress);

            functionAddress     = Kernel32.GetProcAddress(hModule, "exp_setTransparentColor");
            SetTransparentColor = Marshal.GetDelegateForFunctionPointer <SetTransparentColorDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_setGraphics");
            SetGraphics     = Marshal.GetDelegateForFunctionPointer <SetGraphicsDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_setEnabled");
            SetEnabled      = Marshal.GetDelegateForFunctionPointer <SetEnabledDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_isActive");
            IsActive        = Marshal.GetDelegateForFunctionPointer <IsActiveDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_getMousePos");
            GetMousePos     = Marshal.GetDelegateForFunctionPointer <GetMousePosDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_holdMouse");
            HoldMouse       = Marshal.GetDelegateForFunctionPointer <HoldMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_releaseMouse");
            ReleaseMouse    = Marshal.GetDelegateForFunctionPointer <ReleaseMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_holdMousePlus");
            HoldMousePlus   = Marshal.GetDelegateForFunctionPointer <HoldMousePlusDelegate>(functionAddress);

            functionAddress  = Kernel32.GetProcAddress(hModule, "exp_releaseMousePlus");
            ReleaseMousePlus = Marshal.GetDelegateForFunctionPointer <ReleaseMousePlusDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_moveMouse");
            MoveMouse       = Marshal.GetDelegateForFunctionPointer <MoveMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_windMouse");
            WindMouse       = Marshal.GetDelegateForFunctionPointer <WindMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_clickMouse");
            ClickMouse      = Marshal.GetDelegateForFunctionPointer <ClickMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_clickMousePlus");
            ClickMousePlus  = Marshal.GetDelegateForFunctionPointer <ClickMousePlusDelegate>(functionAddress);

            functionAddress   = Kernel32.GetProcAddress(hModule, "exp_isMouseButtonHeld");
            IsMouseButtonHeld = Marshal.GetDelegateForFunctionPointer <IsMouseButtonHeldDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_scrollMouse");
            ScrollMouse     = Marshal.GetDelegateForFunctionPointer <ScrollMouseDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_sendKeys");
            SendKeys        = Marshal.GetDelegateForFunctionPointer <SendKeysDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_holdKey");
            HoldKey         = Marshal.GetDelegateForFunctionPointer <HoldKeyDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_releaseKey");
            ReleaseKey      = Marshal.GetDelegateForFunctionPointer <ReleaseKeyDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_isKeyDown");
            IsKeyDown       = Marshal.GetDelegateForFunctionPointer <IsKeyDownDelegate>(functionAddress);

            functionAddress = Kernel32.GetProcAddress(hModule, "exp_setCapture");
            SetCapture      = Marshal.GetDelegateForFunctionPointer <SetCaptureDelegate>(functionAddress);
        }