import win; //必须首先导入win窗口支持库
import win.ui;
import win.ui.menu;
import win.ole;
/*DSG{{*/
var winform = win.form(parent=...; min=1;bottom=149;max=1;text="AAuto Form";right=302 )
winform.add(
edit={ bottom=49;text="";left=85;top=20;font=LOGFONT( name="宋体";h=-12 );z=0;right=261;edge=1;cls="edit" };
button={ bottom=126;text="登陆";left=169;right=282;top=94;font=LOGFONT( name="宋体";h=-12 );z=2;cls="button" };
static={ bottom=46;text="QQ:";left=17;top=25;font=LOGFONT( name="宋体";h=-12 );transparent=1;right=82;z=3;cls="static" };
static2={ bottom=75;text="QQ密码:";left=12;top=59;font=LOGFONT( name="宋体";h=-12 );transparent=1;right=75;z=4;cls="static" };
edit2={ bottom=84;text="";left=87;top=57;font=LOGFONT( name="宋体";h=-12 );password=1;z=1;right=263;edge=1;cls="edit" }
)
/*}}*/
import win.reg;
import process;
import winex;
EnumChildWindows = ::User32.api("EnumChildWindows","int(int hWndParent,pointer lpEnumFunc,int lParam)")
SendMessageByString = ::User32.api("SendMessageA","int(int hwnd,int wMsg,int wParam,string lParam)")
SetForegroundWindow = ::User32.api("SetForegroundWindow","int(int hwnd)")
var user_hwnd;
var parent_hwnd;
var vbs=/*Set WshShell=createobject("wscript.shell")
WshShell.AppActivate "QQ登录"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "{BACKSPACE}"
WshShell.SendKeys "||密码||"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}" */
//通过读注册表取出QQ的路径
GetQQpath=function(){
var reg = win.reg("HKEY_LOCAL_MACHINE\SOFTWARE\Tencent\PlatForm_Type_List\lu",true)
//读注册表取出QQ的安装路径
if(reg){
return reg.queryValue("TypePath")
//返回路径
}
return 0;
//没取出安装路径则返回0
}
//枚举子程序接口
Childw=function(hwnd){
if(GetClassN(hwnd)!="edit"){
user_hwnd=hwnd
}
}
//取类名
GetClassN=function(hwnd){
var nMaxC=255;
var long,cla = ::GetClassName(hwnd,nMaxC,nMaxC)
return cla;
}
//登陆QQ,login(QQ号码,QQ密码)
LoginQQ = function(qq,pas){
var path = GetQQpath()
//取QQ路径
if(path){
process.execute(path, "","open",0xC/*_WM_SETTEXT*/, "",0)
//如果取出路径则运行QQ
sleep(120)
for hwnd,title,theadId,processId in winex.each( "QQ2010" ) {
if(::GetWindowLong(hwnd,0xFFFFFFF0)=-1765146624){
EnumChildWindows(hwnd,raw.tostdcall(Childw,"void (int hwnd)",),12330)
//枚举出QQ登陆窗口的所有子窗口
if(user_hwnd){
parent_hwnd = hwnd;
SendMessageByString(user_hwnd,0xC/*_WM_SETTEXT*/,0,qq)
//发送QQ号码到登陆框
pas=string.replace(pas,"\\","\\\\")
vbs = string.replace(vbs,"<||密码||>",pas)
//下面是写出VBS并运行,这个VBS的代码是在网上找的
string.save("C:\windows\system32\temp.vbs",vbs )
SetForegroundWindow(hwnd)
::PostMessage(user_hwnd,513,0,0)
::PostMessage(user_hwnd,514,0,0)
::PostMessage(user_hwnd,0x100/*_WM_KEYDOWN*/,9,0)
::PostMessage(user_hwnd,0x101/*_WM_KEYUP*/,9,0)
process.execute("C:\windows\system32\temp.vbs", "","open",0, "",0)
}
}
}
}
}
winform.button.oncommand = function(id,event){
//win.msgbox( winform.button.text );
LoginQQ(winform.edit.text,winform.edit2.text)
}//endproc
winform.show(true)
win.loopMessage();
return winform;
阅读(4368) | 评论(0) | 转发(1) |