我能夠在遊戲植物大戰殭屍中找到Windows,但在生化危機中沒有運氣。有人可以幫助我嗎?我相對而言是新手。C++無法找到窗口
這是代碼簡單,但沒有運氣:(
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#define F6_Key 0x75
using namespace std ;
int main()
{
cout << "Open Game .." << endl ;
system("Pause") ;
LPCWSTR game = L"Resident Evil 0/biohazard 0 HD REMASTER";
HWND hwnd = FindWindowW(0, L"Resident Evil/biohazard HD REMASTER");
if (hwnd == 0)
{
cout << "Not Found." << endl ;
system("Pause") ;
}
else
{
cout << "Success finding game." << endl;
}
return 0 ;
}
爲什麼你要在一個變量中存儲一個字符串文字,只是爲了在別的地方寫出來呢? – Rakete1111
我從網站上拿了樣本,但是如果我刪除L,它會在參數 – user3171557
上標記爲錯誤,我會列舉窗口。也許標題不完全匹配。下面是一個例子:https://gist.github.com/LeZuse/6994454 – drescherjm