zoukankan      html  css  js  c++  java
  • MaxScript用.net调winapi来设置鼠标位置

    也是有网友需要写的范例

    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
  • 相关阅读:
    TO DO List
    springboot 热部署
    <dependencyManagement>的作用
    人体工程学座椅
    temp
    temp
    声明式编程和命令式编程的本质区别
    weak first question
    Spring依赖注入方式和依赖来源
    SpringBoot 整合 H2 数据库
  • 原文地址:https://www.cnblogs.com/sitt/p/3026778.html
Copyright © 2011-2022 走看看