lele1894 lele1894
关注数: 12 粉丝数: 80 发帖数: 250 关注贴吧数: 23
大漠多线单开单停 Dimenv 环境变量名 环境变量名 = 0 Call 注册大漠() Do Key = WaitKey() If key = 33 Then 环境变量名 = Plugin.Window.MousePoint() 线程ID = BeginThread (运行) Call Plugin.File.WriteINI("窗口句柄", 环境变量名, 环境变量名, "c:\test_game\记录.ini") xc = Plugin.File.readINI("线程ID", 环境变量名, "c:\test_game\记录.ini") If xc <> "" Then StopThread xc End If Call Plugin.File.WriteINI("线程ID", 环境变量名, 线程ID, "c:\test_game\记录.ini") End If If key = 34 Then 环境变量名 = Plugin.Window.MousePoint() 关闭线程id = Plugin.File.readINI("线程ID", 环境变量名, "c:\test_game\记录.ini") If 关闭线程id = "" Then MessageBox "当前窗口没启动过线程。" Else StopThread 关闭线程id End If End If Loop EndScript Sub 运行() //这里设置插件基本目录 set dm = createobject("dm.dmsoft") dm.SetPath "c:\test_game" Call 绑定() //你的代码 End Sub Sub OnScriptExit() dm.UnBindWindow End Sub // 结束 Sub 注册大漠() // 首先打包dm.dll和RegDll.dll到附件,当然如果你还有其它资源(字库,图片等)也可以一并打包 // 这个need_ver作为本脚本需要使用的插件版本. 如果要换插件时,记得更改这个值. need_ver = "3.1233" // 插件需要用到atl系统库,有些XP精简系统会把atl.dll精简掉. 为了防止注册失败,这里手动注册一下atl.dll set ws=createobject("Wscript.Shell") ws.run "regsvr32 atl.dll /s" set ws=nothing // 释放附件>>>>>>>>>>>>>>>>>>> // 这里选择c盘的test-_game作为插件的基本目录 也就是SetPath对应的目录。所以所有资源都释放在此目录. PutAttachment "c:\test_game","*.*" // 这里要用到RegDll来注册插件,所以必须释放到Plugin. 但是切记不能把dm.dll释放到Plugin.那会导致插件失效. PutAttachment ".\Plugin" ,"RegDll.dll" // 插件注册开始>>>>>>>>>>>>>>>>>>> // 下面开始注册插件,先尝试用RegDll来注册.这里必须使用绝对路径。以免有别人把dm.dll释放在系统目录.造成版本错误. Call Plugin.RegDll.Reg("c:\test_game\dm.dll") // 这里判断是否注册成功 set dm = createobject("dm.dmsoft") ver = dm.Ver() if ver <> need_ver then // 先释放先前创建的dm set dm = nothing // 再尝试用regsvr32 来注册. 这里必须使用绝对路径。以免有别人把dm.dll释放在系统目录.造成版本错误. set ws=createobject("Wscript.Shell") ws.run "regsvr32 c:\test_game\dm.dll /s" set ws=nothing Delay 1500 // 再判断插件是否注册成功 set dm = createobject("dm.dmsoft") ver = dm.Ver() if ver <> need_ver then // 这时,已经确认插件注册失败了。 弹出一些调试信息,以供分析. messagebox "插件版本错误,当前使用的版本是:"&ver&",插件所在目录是:"&dm.GetBasePath() messagebox "请关闭程序,重新打开本程序再尝试" endscript end if End If // 插件注册结束<<<<<<<<<<<<<<< End Sub Sub 绑定() hwnd = 环境变量名 // 绑定 dm_ret = dm.BindWindow(hwnd,"dx2","dx","dx",0) // 检测绑定返回值 if dm_ret = 0 then last_error = dm.GetLastError() // 如果是WIN7 VISTA WIN2008系统,检测当前系统是否有开启UAC if dm.GetOsType() = 3 then // 有开启UAC的话,尝试关闭 if dm.CheckUAC() = 1 then if dm.SetUAC(0) = 1 then // 关闭UAC之后,必须重启系统才可以生效 messagebox "已经关闭系统UAC设置,必须重启系统才可以生效。点击确定重启系统" dm.ExitOs 2 Delay 2000 endscript end if end if end if // 具体错误码的含义,可以参考函数GetLastError的说明. messagebox "绑定失败,错误码是:"&last_error messagebox "如果确定关闭了UAC,很可能是系统的防火墙拦截插件,请暂时关闭360等安全防火墙再尝试" endscript End If End Sub
大漠多线程 DimEnv 环境变量名 Call 注册大漠() //<>------------------------------ //================主线程==============// While true key = WaitKey() If key = 118 Then 环境变量名 = dm.GetMousePointWindow() BeginThread 多线程 End If Wend //================主线程==============// //<>------------------------------ //================子线程==============// Sub 多线程() i = 0 set dm = createobject("dm.dmsoft") //↑大漠·注册 dm.SetPath ".\plugin\大漠梦想" //↑指定“全局路径” Call 绑定() rem start dm.SendString hwnd, "我是来测试的"&i dm.KeyPress 13 Delay 1000 i = i + 1 Goto start End Sub //================子线程==============// //<>------------------------------ //================子程序==============// Sub 绑定() hwnd = 环境变量名 dm_ret = dm.BindWindow(hwnd,"dx2","normal","windows",0) If dm_ret = 0 Then //1:成功 0:失败 MessageBox "绑定失败" Else TracePrint dm_ret End If End Sub //<>------------------------------ Sub 注册大漠() PutAttachment ".\plugin","*.dll" PutAttachment ".\plugin\大漠梦想","*.bmp" PutAttachment ".\plugin\大漠梦想","*.txt" PutAttachment ".\plugin\大漠梦想","dm.dll" //↑PutAttachment释放附件 Call Plugin.RegDll.Reg(".\plugin\大漠梦想\dm.dll") set dm = createobject("dm.dmsoft") //↑大漠·注册 dm.SetPath ".\plugin\大漠梦想" //↑指定“全局路径” //dm.SetDict 0,"dm_soft.txt" //↑相对路径……第一个·字库 Delay 40 End Sub //<>------------------------------ Sub OnScriptExit() dm_ret = dm.UnBindWindow() End Sub //================子程序==============// Event Form1.InputBox1.Change End Event
欢迎光临datediff吧!本吧的作用~~~ datediff函数 描述:返回两个日期之间的时间间隔。 本吧就是提供一个稳定的网络验证时间的地方。 举个栗子:按键代码2015/03/01 //先把以下函数代码放在脚本任何位置 //获得网页源代码(按键精灵自带的函数无法分辨网页源码的charset(字符集)编码) //GetHTML(URL, code, txtPath) //取网页源文件优化函数(参数别忘带""半角引号) //第一个参数URL需要获得源代码的网址 //第二个参数为网页编码,为空时获取网页头判断,若获取不到则设置为UTF-8。 //也可指定,如GB2312.UTF-8.gbk. //第三个参数将网页源文件保存到txt,相同名覆盖,为空时不存到文件。 Function GetHTML(URL, code, txtPath) Set obj = CreateObject("WinHttp.WinHttpRequest.5.1") Randomize With obj .Open "get", URL&"?"&Rnd .setRequestHeader "Content-Type", "application/x-www-form-urlencoded" .send .waitForResponse httpbody=.responsebody End With Set obj = Nothing If Len(httpbody) = 0 Then GetHTML = "" Exit Function End If If code = "" Then Dim mystr,start,t,i For i = 1 To 300 t = MidB(httpbody, i, 1) mystr=mystr+chr(AscB(t)) Next start=Instr(mystr, "charset=") If start>0 Then code = mid(mystr, start + 8, Instr(start+9, mystr, chr(34))-start-7) code = Replace(code, chr(34), "") Else code="UTF-8" End If End If Set ObjStream = CreateObject("Adodb.Stream") With ObjStream .Type = 1 .Mode = 3 .Open .write httpbody .position = 0 .Type = 2 .Charset = code GetHTML = .ReadText .Close End With Set ObjStream = Nothing IF txtPath <>"" Then If Plugin.File.IsFileExit(txtPath) = True Then Call Plugin.File.DeleteFile(txtPath) End If Call Plugin.File.WriteFileEx(txtPath,GetHTML) End If End Function //获得网页源码,返回值是网页源码 //(因为帖子没有发表,没有地址,发了好像又不能修改,记得下行地址修改下) 返回值 = GetHTML("http://本贴地址", "", "") //下行代码去掉//可以弹出获得的源码 //MessageBox 返回值 //在返回的源码中搜索按键代码四个字 搜索 = InStr(返回值, "按键代码") //弹出搜索到4个字(+4是越过按键代码4个字)显示后面10个字符(10) MessageBox Mid(返回值, 搜索 + 4, 10) //最后弹出的就是2015/03/01 Sub 时间() //返回值日期时间的两个网址是一个返回日期,一个返回时间(没有其他编码只有时间)我们只使用日期 返回值日期 = GetHTML("http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fsymental.com%2Ftime%2Fdate.asp&urlrefer=e830b56353ffe7e05da0a9b52f6c4c76", "", "") 返回值时间 = GetHTML("http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fsymental.com%2Ftime%2Ftime.asp&urlrefer=89ef95649abdc1496b44ec80463d9157", "", "") //取返回的源代码10个字符 日期 = Left(返回值日期, 10) //用到DateDiff函数了参数1:“d”是返回对比日期隔了多少“日” //参数2日期是我们区的网络时间 //参数3从本网页取的日期 //返回 间隔值参数 两个参数相差多少天 间隔值=DateDiff("d", 日期,Mid(返回值, 搜索 + 4, 10) ) //弹出 MessageBox "当前时间"&日期&vbcrlf&"到期时间"&Mid(返回值, 搜索 + 4, 10)&vbcrlf&"还有"&间隔值&"天过期" End Sub 代码出处http://tieba.baidu.com/mo/q/checkurl?url=http%3A%2F%2Fbbs.anjian.com%2Fthread-415260-1-1.html&urlrefer=64c8cf476195ec07151a4f7dea960e0c
1 下一页