TC官方合作论坛

 找回密码
 立即注册
查看: 1253|回复: 3

[源码分享] DNF自动登陆代码 给需要的同学

[复制链接]
发表于 2012-12-10 15:35:26 | 显示全部楼层 |阅读模式

马上加入TC

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

x
因为回贴有数字限制  所以只能重新发帖了namespace DNFAuto

int  myhan
string  path
string QQpas,QQuser,getcom_tex
string  write_psw,write_user,write_bro,Wcom_tex
string  read_psw,read_user,read_bro,Rcom_tex
int x,y,wx,wy,hwnd
bool state
function bool getpos()//找区
    int isfind
    while(true)
        isfind=window.findwindow("地下城与勇士")
        if(isfind>0)
            break
        endif
    endwhile
    //help.sleep(1000)
  string ret=system.enum(convert.inttostr(isfind),3)
  string[] str_hand
  bool isok=str.split(ret,"|",str_hand)
  int c1,i=0,hander,count
array.size(str_hand,c1)
while(i<c1)
    if(window.getwindowcaption(convert.strtoint(str_hand,0))==getcom_tex)
   hander=convert.strtoint(str_hand)
   break
  endif
     i=i+1
endwhile
   if(hander<0)
       help.messagebox("Not Finded:DNFchina")
   endif
  window.getwindowpos(hander,x,y)//获取句柄的坐标
   help.sleep(1000)
  window.leftdoubleclick(hander,x,y)//双击x,y坐标
  thread.beginthread("DNFAuto.send_dnf","")
return true
endfunction
function bool send_dnf()//向密码框发送密码
    int isfind
    while(true)
        isfind=window.findwindow("","TWINCONTROL")
        if(isfind>0)
            break
        endif
    endwhile
     help.sleep(3000)
  string ret=system.enum(convert.inttostr(isfind),3)
  string[] str_hand
  bool isok=str.split(ret,"|",str_hand)
  if(isok==false)
        help.messagebox("NotFind:PassWordEdit...")
    endif
  int c1,i=0,hander,hander1,count
  array.size(str_hand,c1)

while(i<c1)
    if(window.getwindowtype(convert.strtoint(str_hand,0))=="Edit")
   count=i
   hander=convert.strtoint(str_hand[count])
  endif
     i=i+1
endwhile
        state=check.getstate("check0")
      help.sleep(5*1000)
      QQpas=edit.gettext("Qinput")
      QQuser=edit.gettext("QQ_user")
      help.sleep(500)
      if(state==true)
          drivekeyboard.keydown(9)
            help.sleep(500)
          drivekeyboard.keyup(9)        
          drivekeyboard.keypress (8,10)
            help.sleep(2000)         
          drivekeyboard.keystring(QQuser)
             help.sleep(1000)
          drivekeyboard.keydown(9)
             help.sleep(500)
          drivekeyboard.keyup(9)
          endif
       drivekeyboard.keystring(QQpas)
      help.sleep(500)
       window.postkeypress(hander,13)
   return true  
endfunction
//_________________________
function bool start_click()
path=browse.gettext("Dpath")
  process.openprocess(path)
myhan=window.getmyhwnd()
  window.setwindowmin(myhan)
getcom_tex=combo.gettext("ComB_D")
  help.sleep(2000)
thread.beginthread("DNFAuto.getpos","")
return true
endfunction



function bool init()
read_psw=help.readini("ini_file","qq_psw",".\\Config.ini")
  edit.settext("Qinput",read_psw)
  read_user=help.readini("ini_file","qq_user",".\\Config.ini")
  edit.settext("QQ_user",read_user)
read_bro=help.readini("ini_file","path_bro",".\\Config.ini")
  browse.settext("Dpath",read_bro)
Rcom_tex=help.readini("ini_file","Wcom_tex",".\\Config.ini")
  combo.setcursel("ComB_D",convert.strtoint(Rcom_tex))





return true
endfunction


function bool Save_qq_click()
write_psw=edit.gettext("Qinput")
  help.writeini("ini_file","qq_psw",write_psw,".\\Config.ini")
return true
endfunction

function bool Dpath_selectchanged()
write_bro=browse.gettext("Dpath")
  help.writeini("ini_file","path_bro",write_bro,".\\Config.ini")

return true
endfunction


function bool ComB_D_selectchanged()

int getID=combo.getcursel("ComB_D")

   help.writeini("ini_file","Wcom_tex",convert.inttostr(getID),".\\Config.ini")
return true
endfunction
function bool DNFAuto_close()
write_user=edit.gettext("QQ_user")
  help.writeini("ini_file","qq_user",write_user,".\\Config.ini")
help.exit()
return true
endfunction

endnamespace



回复

使用道具 举报

发表于 2012-12-10 17:21:44 | 显示全部楼层
太支持啦
回复 支持 反对

使用道具 举报

发表于 2012-12-10 17:48:44 | 显示全部楼层
看帖就要回帖!!!
回复 支持 反对

使用道具 举报

发表于 2013-1-6 20:20:31 | 显示全部楼层
看bu懂
回复 支持 反对

使用道具 举报

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

本版积分规则

关闭

推荐上一条 /2 下一条

关闭

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

GMT+8, 2024-5-21 05:05 , Processed in 0.033875 second(s), 22 queries .

Powered by 海安简单软件服务部

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

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