TC官方合作论坛

 找回密码
 立即注册
查看: 946|回复: 1

[脚本] 求sapy++怎么改写成自己的脚本啊 .下面是源码

[复制链接]
发表于 2016-2-15 15:12:27 | 显示全部楼层 |阅读模式

马上加入TC

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
空间 dllcall实例之TC实现spy加加效果
//默认空间
当前句柄
handle
phwnd=array[3]

功能 刷新_时钟()
    //这里添加你要执行的代码
    当前句柄=窗口.鼠标所在窗口句柄()
    编辑框.设置文本("句柄",当前句柄)
    编辑框.设置文本("标题",窗口.类名(当前句柄))
    编辑框.设置文本("类名",窗口.得到标题(当前句柄))
    dllcall实例之TC实现spy加加效果.画边框()
功能结束

//下面这个函数由飞灵所写,dllcall的注释已经很详细了,示例中就不做修改了
功能 画边框()
    var DesktopWindowHwnd, DesktopWindowDC, DrawMode, PenHwnd, OldPenHwnd
    var rect_left, rect_top, rect_right, rect_bottom
    //==================↑变量定义区↑====================      
    DesktopWindowHwnd = dllcall("user32.dll", "int", "GetDesktopWindow")  //取桌面窗口句柄
    DesktopWindowDC = dllcall("user32.dll", "int", "GetWindowDC", "int", DesktopWindowHwnd)  //取窗口设备场景
    DrawMode = dllcall("gdi32.dll", "int", "SetROP2", "int", DesktopWindowDC, "int", 10)  //设置指定设备场景的绘图模式,并返回窗口前一个绘图模式
    window.getwindowpos(当前句柄, rect_left, rect_top)
    window.getwindowsize(当前句柄, rect_right, rect_bottom)
    rect_right = rect_left + rect_right
    rect_bottom = rect_top + rect_bottom  //获得整个窗口的范围矩形,窗口的边框、标题栏、滚动条及菜单等都在这个矩形内
    PenHwnd = dllcall("gdi32.dll", "int", "CreatePen", "int", 0, "int", 4, "int", #00ff00)  //用指定的样式、宽度和颜色创建一个画笔,并返回一个画笔句柄
    OldPenHwnd = dllcall("gdi32.dll", "int", "SelectObject", "int", DesktopWindowDC, "int", PenHwnd)  //选入设备场景,并返回以前选入设备场景的相同hObject类型的一个对象的句柄
    dllcall("gdi32.dll", "int", "Rectangle", "int", DesktopWindowDC, "int", rect_left - 1, "int", rect_top - 1, "int", rect_right + 1, "int", rect_bottom + 1)
    //help.sleep(500)
    //dllcall("gdi32.dll", "int", "Rectangle", "int", DesktopWindowDC, "int", rect_left - 1, "int", rect_top - 1, "int", rect_right + 1, "int", rect_bottom + 1)  //用当前选定的画笔描绘矩形,并用当前选定的刷子进行填充      
    dllcall("gdi32.dll", "int", "SelectObject", "int", DesktopWindowDC, "int", OldPenHwnd)  //选入设备场景
    dllcall("gdi32.dll", "int", "SetROP2", "int", DesktopWindowDC, "int", DrawMode)  //设置指定设备场景的绘图模式        
    dllcall("gdi32.dll", "int", "DeleteObject", "int", PenHwnd)  //删除对象
    dllcall("user32.dll", "int", "ReleaseDC", "int", DesktopWindowHwnd, "int", DesktopWindowDC) //释放由调用GetDC或GetWindowDC函数获取的指定设备场景
功能结束

//消息路由功能
功能 dllcall实例之TC实现spy加加效果_消息路由(句柄,消息,w参数,l参数,时间,x坐标,y坐标)
    if(消息 == 512)
        xx=0
        if(句柄 == handle)
            dllcall("user32.dll", "int", "SetClassLongA", "int", handle, "int", -12, "int", phwnd[0])  //设置鼠标指针为 光标.ico
            xx=1
        endif
        if(xx==0)
            dllcall("user32.dll", "int", "SetClassLongA", "int", handle, "int", -12, "int", phwnd[1])  //设置鼠标指针为 光标.ico
        endif
    endif

    //==================↑设置鼠标指针↑====================           

    if(句柄 == handle && 消息 == 513)      
        timer.register("刷新", 500)  //注册时钟      
        picture.setpicture("鼠标", "rc:bk0.bmp")  //设置"图片框_鼠标拖拽框"图片
        dllcall("user32.dll", "int", "SetCapture", "int", handle)  //捕获鼠标
    endif
    //==================↑左键按下事件↑====================           

    if(句柄 == handle && 消息 == 514)
        timer.kill("刷新")
        dllcall("user32.dll", "int", "ReleaseCapture")  //释放鼠标  
        dllcall("user32.dll", "int", "SetClassLongA", "int", handle, "int", -12, "int", phwnd[1])   
        picture.setpicture("鼠标", "rc:bk1.bmp")  //设置"图片框_鼠标拖拽框"图片

    endif

    返回 假
功能结束

功能 初始化()
    //这里添加你要执行的代码
    rcpath = help.getrcpath("rc:")
    handle = control.gethandle("鼠标")

    phwnd[0] = dllcall("user32.dll", "int", "LoadCursorFromFileA", "char *", rcpath & "eye.cur")  //取鼠标指针 光标.ico 句柄
    phwnd[1] = dllcall("user32.dll", "int", "GetClassLongA", "int", handle, "int", -12)  //取默认鼠标指针句柄
    phwnd[2] = dllcall("user32.dll", "int", "LoadCursorFromFileA", "char *", rcpath & "坐标.cur")  //取鼠标指针 光标.ico 句柄

功能结束


功能 按钮0_点击()
    //这里添加你要执行的代


功能结束


功能 按钮1_点击()
    //这里添加你要执行的代码

功能结束

空间结束
//空间结束语句

回复

使用道具 举报

 楼主| 发表于 2016-2-15 15:13:19 | 显示全部楼层
比如说实现最简单的鼠标后台操作 要怎么写
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条

关闭

小黑屋|TC官方合作论坛 (苏ICP备18045623号)

GMT+8, 2024-6-12 03:30 , Processed in 0.035080 second(s), 22 queries .

Powered by 海安简单软件服务部

© 2008-2019 版权所有 保留所有权利

快速回复 返回顶部 返回列表