Listing 2 "sprintf-ing" info into the message box
BOOL check_wndtext_len(HWND hwnd, LPCTSTR txt) { #ifdef _DEBUG if( hwnd != NULL && !IsWindow(hwnd)) { CHAR msg[260]; wsprintf( msg, "The given window handle (0x%08x) was invalid", hwnd); MessageBox( NULL, msg, "check_wndtext_len", MB_ICONEXCLAMATION); } #endif /* _DEBUG */ return hwnd != NULL && lstrlenA(txt) < GetWindowTextLength(hwnd); }