怎么一键打开QQ主面板

QQ热键里面有提取消息的快捷键设置,但是没有单独打开主面板的快捷键,贴边隐藏又很容易遮挡住浏览器的标签,所以很不方便。
有没有办法用快捷键打开QQ主面板(不是聊天消息)?

我记得在没有消息的情况下,ctrl + alt + z 是能打开面板的呀

不行的

不行呀

1 Like

如果你用 Quicker 的话,可以用 触发托盘 这个动作实现。

用 AHK 的话,可以用下面这段代码。

原理都是模拟点击 QQ 的托盘图标来唤出主面板。

TrayIcon_Button("QQ.exe","L")

TrayIcon_Button(sExeName, sButton := "L", bDouble := true, index := 1)
{
    Setting_A_DetectHiddenWindows := A_DetectHiddenWindows
    DetectHiddenWindows, On
    WM_MOUSEMOVE      = 0x0200
    WM_LBUTTONDOWN    = 0x0201
    WM_LBUTTONUP      = 0x0202
    WM_LBUTTONDBLCLK = 0x0203
    WM_RBUTTONDOWN    = 0x0204
    WM_RBUTTONUP      = 0x0205
    WM_RBUTTONDBLCLK = 0x0206
    WM_MBUTTONDOWN    = 0x0207
    WM_MBUTTONUP      = 0x0208
    WM_MBUTTONDBLCLK = 0x0209
    sButton := "WM_" sButton "BUTTON"
    oIcons := {}
    oIcons := TrayIcon_GetInfo(sExeName)
    msgID  := oIcons[index].msgID
    uID    := oIcons[index].uID
    hWnd   := oIcons[index].hWnd
	
    if bDouble
        PostMessage, msgID, uID, %sButton%DBLCLK, , ahk_id %hWnd%
    else
    {
        PostMessage, msgID, uID, %sButton%DOWN, , ahk_id %hWnd%
        PostMessage, msgID, uID, %sButton%UP, , ahk_id %hWnd%
    }
    DetectHiddenWindows, %Setting_A_DetectHiddenWindows%
    return
}




TrayIcon_GetInfo(sExeName:="") {
    d := A_DetectHiddenWindows
	DetectHiddenWindows, On   

    oTrayInfo := Object()
	;~ For key, sTrayP in ["Shell_TrayWnd", "NotifyIconOverflowWindow"]			;Win7
	For key, sTrayP in ["NotifyIconOverflowWindow", "Shell_TrayWnd"]		;Win10
    {	
        idxTB := TrayIcon_GetTrayBar()
        WinGet, pidTaskbar, PID, ahk_class %sTrayP%

        hProc := DllCall( "OpenProcess",    UInt,0x38, Int,0, UInt,pidTaskbar                       )
        pRB   := DllCall( "VirtualAllocEx", Ptr,hProc, Ptr,0, UInt,20,        UInt,0x1000, UInt,0x4 )


        szBtn := VarSetCapacity( btn, (A_Is64bitOS) ? 32 : 24, 0 )
        szNfo := VarSetCapacity( nfo, (A_Is64bitOS) ? 32 : 24, 0 )
        szTip := VarSetCapacity( tip, 128 * 2,                 0 )


        ;SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class %sTrayP% ; TB_BUTTONCOUNT		;Win7
		;SendMessage, 0x418, 0, 0, ToolbarWindow32%key%, ahk_class %sTrayP%   ; TB_BUTTONCOUNT		;Win10
		if ("Shell_TrayWnd" == sTrayP) {
			SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class %sTrayP%   ; TB_BUTTONCOUNT
		} else if ("NotifyIconOverflowWindow" == sTrayP) {
			SendMessage, 0x418, 0, 0, ToolbarWindow32%key%, ahk_class %sTrayP%   ; TB_BUTTONCOUNT
		}
			
        Loop, %ErrorLevel%
        {
            ;SendMessage, 0x417, A_Index - 1, pRB, ToolbarWindow32%idxTB%, ahk_class %sTrayP% ; TB_GETBUTTON		;Win7
			;SendMessage, 0x417, A_Index - 1, pRB, ToolbarWindow32%key%, ahk_class %sTrayP%   ; TB_GETBUTTON		;Win10
			if ("Shell_TrayWnd" == sTrayP) {
				SendMessage, 0x417, A_Index - 1, pRB, ToolbarWindow32%idxTB%, ahk_class %sTrayP%   ; TB_GETBUTTON
			} else if ("NotifyIconOverflowWindow" == sTrayP) {
				SendMessage, 0x417, A_Index - 1, pRB, ToolbarWindow32%key%, ahk_class %sTrayP%   ; TB_GETBUTTON
			}


            DllCall( "ReadProcessMemory", Ptr,hProc, Ptr,pRB, Ptr,&btn, UInt,szBtn, UInt,0 )

            iBitmap	:= NumGet( btn, 0                       )
            idCmd   := NumGet( btn, 4                       )
            Statyle := NumGet( btn, 8                       )
            dwData	:= NumGet( btn, (A_Is64bitOS) ? 16 : 12 )
            iString	:= NumGet( btn, (A_Is64bitOS) ? 24 : 16 )

            DllCall( "ReadProcessMemory", Ptr,hProc, Ptr,dwData, Ptr,&nfo, UInt,szNfo, UInt,0 )

            hWnd  := NumGet( nfo, 0                       )
            uID	  := NumGet( nfo, (A_Is64bitOS) ? 8  : 4  )
            nMsg  := NumGet( nfo, (A_Is64bitOS) ? 12 : 8  )
            hIcon := NumGet( nfo, (A_Is64bitOS) ? 24 : 20 )

            WinGet,      pid,      PID,         ahk_id %hWnd%
            WinGet,      sProcess, ProcessName, ahk_id %hWnd%
            WinGetClass, sClass,                ahk_id %hWnd%

            If ( !sExeName || (sExeName == sProcess) || (sExeName == pid) )
                DllCall( "ReadProcessMemory", Ptr,hProc, Ptr,iString, Ptr,&tip, UInt,szTip, UInt,0 )
              , oTrayInfo.Insert({ "idx": A_Index-1, "idcmd": idCmd, "pid": pid, "uid": uID, "msgid": nMsg
                                 , "hicon": hIcon, "hwnd": hWnd, "class": sClass, "process": sProcess
                                 , "tooltip": StrGet(&tip, "UTF-16"), "place": sTrayP })
								 
        }
        
        DllCall( "VirtualFreeEx", Ptr,hProc, Ptr,pRB, UInt,0, UInt,0x8000 )
        DllCall( "CloseHandle",   Ptr,hProc                               )
	}
	DetectHiddenWindows, %d%
	Return oTrayInfo
}


TrayIcon_Hide(idCmd, sTrayP:="Shell_TrayWnd", bHide:=True) {
    d := A_DetectHiddenWindows
	DetectHiddenWindows, On
	idxTB := TrayIcon_GetTrayBar()
	SendMessage, 0x404, idCmd, bHide, ToolbarWindow32%idxTB%, ahk_class %sTrayP% ; TB_HIDEBUTTON
	SendMessage, 0x1A, 0, 0, , ahk_class %sTrayP%
    DetectHiddenWindows, %d%
}


TrayIcon_Remove(hWnd, uID) {
	sz := VarSetCapacity( NID, (A_PtrSize == 4) ? 832 : 848, 0 )
	NumPut( sz, NID, 0 ), NumPut( hWnd, NID, A_PtrSize ), NumPut( uID, NID, A_PtrSize*2 )
	DllCall( "Shell32.dll\Shell_NotifyIcon", UInt,2, Ptr,&NID )
}


TrayIcon_Delete(idx, sTrayP:="Shell_TrayWnd") {
    d := A_DetectHiddenWindows
	DetectHiddenWindows, On
	idxTB := TrayIcon_GetTrayBar()
	SendMessage, 0x416, idx, 0, ToolbarWindow32%idxTB%, ahk_class %sTrayP% ; TB_DELETEBUTTON
	SendMessage, 0x1A, 0, 0, , ahk_class %sTrayP%
	DetectHiddenWindows, %d%
}


TrayIcon_Move(idxOld, idxNew, sTrayP:="Shell_TrayWnd") {
    d := A_DetectHiddenWindows
	DetectHiddenWindows, On
	idxTB := TrayIcon_GetTrayBar()
	SendMessage, 0x452, idxOld, idxNew, ToolbarWindow32%idxTB%, ahk_class %sTrayP% ; TB_MOVEBUTTON
    DetectHiddenWindows, %d%
}


TrayIcon_GetTrayBar() {
    d := A_DetectHiddenWindows
	DetectHiddenWindows, On
	WinGet, ControlList, ControlList, ahk_class Shell_TrayWnd
	RegExMatch(ControlList, "(?<=ToolbarWindow32)\d+(?!.*ToolbarWindow32)", nTB)

	Loop, %nTB%
	{
		ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
		hParent := DllCall( "GetParent", Ptr,hWnd )
		WinGetClass, sClass, ahk_id %hParent%
		If (sClass <> "SysPager")
			Continue
		idxTB := A_Index
			Break
	}
	
	DetectHiddenWindows, %d%
	Return	idxTB
}


TrayIcon_GetHotItem() {
   idxTB := TrayIcon_GetTrayBar()
   SendMessage, 0x447, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_GETHOTITEM
   Return ErrorLevel << 32 >> 32
}

啊,我一直用的ctrl + alt + z

版本号9.6.0
就是提取消息的快捷键,我设置成ctrl+shift+E了

不是要提取消息,是要快捷键显示QQ面板哦

多谢,但是我没有用quicker。

直接显示 QQ 窗口应该可以,aardio 代码:

import win;
var hwnd = win.find("TXGuiFoundation","QQ");
win.showForeground(hwnd);

ImTip 超级热键:

["CTRL+Q"] = function(){
	var hwnd = win.find("TXGuiFoundation","QQ");
	if(!hwnd){
		var qqPath  = fsys.lnk.search( {"qq.exe";"QQScLauncher.exe";"QQProtect.exe"} )  
		process.execute( qqPath );
		return; 
	} 
	win.showForeground(hwnd);	
}

感谢大佬!ImTip 超级热键可行!