Why does not this recognize the "string" pcBuf?? It seems like the result of the line where it is filled(pcBuf) does not do anything, because when I pass to FindWindow, nothing happend. Notice the check after, to see if a handle was actually found. When i run the program, it always pops up the Message box, meaning something went wrong. But what?? Would it be the TCHAR stuff?Code:if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == hbtnGetHandle) { int input_len = GetWindowTextLength(htxtGetWindow); TCHAR *pcBuf = new TCHAR[input_len]; GetWindowText(htxtGetWindow, pcBuf, input_len); new_hwnd = NULL; new_hwnd = FindWindow(NULL, pcBuf); if(new_hwnd == NULL) { MessageBox(hwnd,"No window with that title found!" ,"Hrmmm..." , MB_OK | MB_ICONEXCLAMATION); } }
Thanks for helping me fixing this![]()




Reply With Quote