以下程序用於打印具有焦點的窗口的名稱或至少是程序運行的命令提示符的名稱。但它只打印一個字符,它是W
。爲什麼這樣?我在哪裏犯錯誤?窗口的名稱沒有打印
#include <Windows.h>
#include <stdio.h>
int main() {
TCHAR title[500];
int i=0;
while(i<10) {
GetWindowText(GetForegroundWindow(), title, 500);
printf("%s\n",title);
i++;
system("pause");
}
}
停止'TCHAR'ing已經和使用'wchar_t'。它是2012. – elmigranto