也是有网友需要写的范例

 

Fn GetFunctionSetCursorPos = 
(
    local result = undefined
    if DotNetClass "WinAPI.Utilities" == undefined then
    (
        CSharpCodeSource ="using System;
        using System.Runtime.InteropServices;
        namespace WinAPI
        {
            public class Utilities
            {
                [DllImport(\"user32.dll\", EntryPoint = \"SetCursorPos\")] 
                public static extern int SetCursorPos(int x, int y); 
            }
        }
        "
        CSharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
        CompilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"

        CompilerParams.ReferencedAssemblies.Add("System.dll")
        CompilerParams.GenerateExecutable = false
        CompilerParams.GenerateInMemory = true

        CompilerResults = CSharpProvider.CompileAssemblyFromSource CompilerParams #(CSharpCodeSource)

        WinAssembly = CompilerResults.CompiledAssembly
        tempObject = WinAssembly.CreateInstance "WinAPI.Utilities"
        result = tempObject.SetCursorPos
    )
    else
    (
        result = (DotNetClass "WinAPI.Utilities").SetCursorPos
    )
    result 
)

SetCursorPos = GetFunctionSetCursorPos()
SetCursorPos 0 0

 

 

 

相关文章:

  • 2021-05-30
  • 2021-04-09
  • 2022-12-23
  • 2021-12-23
  • 2022-02-03
  • 2022-12-23
猜你喜欢
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案