I have problem with this code,I want to print names of the windows in .txt file and it compile with no errors but it snaps in runtime.
this function int x = GetWindowText(hWnd,title, 256); for the second arg require char* and cant deal with WCHAR and if i cast title to (char*), function wcscpy(oldTitle, title) wont work
how to solve this?
char c[10];
WCHAR title[128];
WCHAR oldTitle[128];
HWND hWnd;
hWnd = GetForegroundWindow();
int x = GetWindowText(hWnd,title, 256);
if(wcscmp(oldTitle, title) && wcscmp(L"", title))
{
for(int i = 0; i < x; i++)
fprintf(File, "%c", title[i]);
fprintf(File, "\n");
}
wcscpy(oldTitle, title);