C++获取当前已登陆的QQ号

string getQQ()
{
HWND hWnd = GetDesktopWindow();//获取桌面句柄
HWND a = GetWindow(hWnd, GW_CHILD);
char data[100];
string as = "";
string temp = "";
int i = 0;
while (a)
{
GetWindowTextA(a, data, MAX_PATH);

if (strstr(data, "QQ_"))
{
temp = data;
temp = temp.substr(temp.find("_")+1, temp.rfind("_")-3);
as += temp;
as += "=";


}

a = GetWindow(a, GW_HWNDNEXT);
}


return as;
}

  

posted @ 2022-05-06 21:08  New_Crazy  阅读(350)  评论(0编辑  收藏  举报