I cant see what im doing wrong.
Neither GetWindowTextLength(hwnd) nor GetWindowText(hwnd, buf2, length)
returning anything.
Code:#include <windows.h> #include <iostream> using namespace std; int main() { HWND hwnd; char *buf2; int length; length=GetWindowTextLength(hwnd); buf2 = new TCHAR[length+1]; int nChars = GetWindowText(hwnd, buf2, length); cout << "Windowtext: " << buf2 << "\n"; cout << length << " characters.\n"; delete[] buf2; return 0; }