4

現在のウィンドウ タイトルをコンソールやファイルに書き込みたいのですが、LPWSTRtochar *またはconst char *. 私のコードは次のとおりです。

LPWSTR title = new WCHAR();
HWND handle = GetForegroundWindow();
GetWindowText(handle, title, GetWindowTextLength( handle )+1);

/*Problem is here */
char * CSTitle ???<??? title

std::cout << CSTitle;

FILE *file;
file=fopen("file.txt","a+");
fputs(CSTitle,file);
fclose(file);
4

2 に答える 2