获取本机已登录的 QQ

许多实用脚本和封装函数, 可以让您编写脚本更加便捷高效
tmplinshi
Posts: 1281
Joined: 01 Oct 2013, 14:57

获取本机已登录的 QQ

06 Oct 2014, 05:44

Code: Select all

MsgBox, % GetLoggedinQQ()

GetLoggedinQQ() {
	static hModule := DllCall("LoadLibrary", "Str", "GetLoggedinQQ.dll")
	static _ := { base: {__Delete: "GetLoggedinQQ"} }
	If !_
		DllCall("FreeLibrary", "Ptr", hModule)
	Else
		Return DllCall("GetLoggedinQQ.dll\getkeys", "Cdecl Str")
}
GetLoggedinQQ.dll 下载地址: http://pan.baidu.com/s/1jG5iROU

GetLoggedinQQ.dll 来自 http://bbs.tyuyan.com/thread-37600-1-1.html,原文件名为 test.dll。
User avatar
RobertL
Posts: 540
Joined: 18 Jan 2014, 01:14
Location: China

Re: 获取本机已登录的 QQ

06 Oct 2014, 08:10

好东西,这种小片段非常易用,易理解。

顺带无聊下。感觉下面这样效率会高那么一点点(每次少一次!运算)..也是顺手的事。

Code: Select all

If _
	Return DllCall("GetLoggedinQQ.dll\getkeys", "Cdecl Str")
Else
	DllCall("FreeLibrary", "Ptr", hModule)
无聊完毕..
我为人人,人人为己?
tmplinshi
Posts: 1281
Joined: 01 Oct 2013, 14:57

Re: 获取本机已登录的 QQ

06 Oct 2014, 08:18

跟着你一起无聊...

Code: Select all

GetLoggedinQQ() {
	static hModule := DllCall("LoadLibrary", "Str", "GetLoggedinQQ.dll")
	static _ := { base: {__Delete: "GetLoggedinQQ"} }
	Return _ ? DllCall("GetLoggedinQQ.dll\getkeys", "Cdecl Str")
	         : DllCall("FreeLibrary", "Ptr", hModule)
}
User avatar
huyaowen
Posts: 100
Joined: 28 Jul 2014, 01:15

Re: 获取本机已登录的 QQ

11 Oct 2014, 03:39

QQ截图20141011162816.png
为什么
tmplinshi
Posts: 1281
Joined: 01 Oct 2013, 14:57

Re: 获取本机已登录的 QQ

29 Oct 2014, 07:02

huyaowen wrote:
QQ截图20141011162816.png
为什么
不知道哦
tmplinshi
Posts: 1281
Joined: 01 Oct 2013, 14:57

Re: 获取本机已登录的 QQ

29 Oct 2014, 07:06

用记事本看了下 GetLoggedinQQ.dll,发现也是用 Webbrowser 控件获取的:
QQ截图20141029200525.png
用 ahk 就可以这样实现:

Code: Select all

MsgBox, % GetLoggedinQQ()

GetLoggedinQQ() {
	static wb

	Gui, New
	Gui, Add, ActiveX, w0 h0 vwb, http://xui.ptlogin2.qq.com/cgi-bin/qlogin
		While wb.readystate != 4 || wb.busy
			Sleep, 100
		wb.document.parentWindow.execScript("Javascript:document.body.innerHTML=GetuinKey(); function GetuinKey(){var text="""";var q_hummerQtrl=null;var g_vOptData=null;if(window.ActiveXObject){try{q_hummerQtrl=new ActiveXObject(""SSOAxCtrlForPTLogin.SSOForPTLogin2"");var A=q_hummerQtrl.CreateTXSSOData();q_hummerQtrl.InitSSOFPTCtrl(0,A);g_vOptData=q_hummerQtrl.CreateTXSSOData();var a=q_hummerQtrl.DoOperation(1,g_vOptData);var V=a.GetArray(""PTALIST"");var f=V.GetSize();var H=$(""list_uin"");for(var g=0;g<f;g++){var E=V.GetData(g);var P=E.GetDWord(""dwSSO_Account_dwAccountUin"");var U=E.GetStr(""strSSO_Account_strNickName"");var G=E.GetBuf(""bufST_PTLOGIN"");var A=G.GetSize();var N="""";for(var Y=0;Y<A;Y++){var B=G.GetAt(Y).toString(""16"");if(B.length==1){B=""0""+B};N+=B};text+=P+'|'+U+'|'+N+';'}}catch(b){}};return text};")
		result := wb.document.body.innerHTML
	Gui, Destroy

	Return result
}

Code: Select all

MsgBox, % GetLoggedinQQ2()

GetLoggedinQQ2() {
    static wb

    Gui, New
    Gui, Add, ActiveX, w0 h0 vwb, % "http://xui.ptlogin2.qq.com/div/qlogin_div.html?lang=2052&flag2=3&u1=http%3A%2F%2Fopenapi.qzone.qq.com%2Foauth%2Fqzoneoauth_authorize%3Foauth_consumer_key%3D10011438%26oauth_token%3D13258956580466405324%26src%3D1&appid=15004501&wording=%u767B%u5F55&css=http%3A%2F%2Fimgcache.qq.com%2Fptcss%2Fb2%2Fsjpt%2F15004501%2Fqlogin.css&ptredirect=2&ptui_version=10009#1167644610421"
        While wb.readystate != 4 || wb.busy
            Sleep, 100
        result := wb.Document.getElementByID("qlogin_select").InnerText
        ; result := wb.Document.getElementByID("list_uin").InnerText
    Gui, Destroy

    Return result
}
Last edited by tmplinshi on 21 Feb 2015, 19:43, edited 1 time in total.
aamii
Posts: 47
Joined: 23 May 2014, 03:50

Re: 获取本机已登录的 QQ

29 Oct 2014, 10:05

这个……,很赞!
lanjz
Posts: 1
Joined: 15 Aug 2016, 02:37

Re: 获取本机已登录的 QQ

15 Aug 2016, 03:56

前面的不能用了,修改了下

Code: Select all

MsgBox, ,当前运行QQ号码 , % GetLoggedinQQ()
 
GetLoggedinQQ() {
	static wb
 
	Gui, New
	Gui, Add, ActiveX, w0 h0 vwb, % "http://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=501038301&proxy_url=http%3A%2F%2Fid.qq.com%2Flogin%2Fproxy.html&s_url=http%3A%2F%2Fim.qq.com%2F"
		While wb.readystate != 4 || wb.busy
			Sleep, 100
		result := wb.document.body.innerHTML
		qq := ""
		loop
		{
			RegExMatch(result, "O)uin=""(\d+)"">", match, (match ? match.Pos(1) : 1))
			if (not match)
			{
				break
			}
			qq .= match.Value(1) . ", "
		}
		qq := RTrim(qq, " ,")
	Gui, Destroy
 
	Return qq
}

GuiClose:
	ExitApp

Return to “脚本函数”

Who is online

Users browsing this forum: No registered users and 5 guests