BOOL CALLBACK Alert::FindTextBoxes(HWND hwnd, LPARAM arg) { std::vector<HWND>* dialog_handles = reinterpret_cast<std::vector<HWND>*>(arg); std::vector<wchar_t> child_window_class(100); ::GetClassName(hwnd, &child_window_class[0], 100); if (wcscmp(&child_window_class[0], L"Edit") == 0) { dialog_handles->push_back(hwnd); } return TRUE; }
BOOL CALLBACK Alert::FindDirectUIChild(HWND hwnd, LPARAM arg){ HWND *dialog_handle = reinterpret_cast<HWND*>(arg); std::vector<wchar_t> child_window_class(100); ::GetClassName(hwnd, &child_window_class[0], 100); if (wcscmp(&child_window_class[0], L"DirectUIHWND") != 0) { return TRUE; } *dialog_handle = hwnd; return FALSE; }
bool Alert::IsPasswordEdit(HWND edit_handle) { std::vector<wchar_t> child_window_class(100); ::GetClassName(edit_handle, &child_window_class[0], 100); if (wcscmp(&child_window_class[0], L"Edit") == 0) { long window_long = ::GetWindowLong(edit_handle, GWL_STYLE); bool is_password = (window_long & ES_PASSWORD) == ES_PASSWORD; return is_password; } return false; }
BOOL CALLBACK Alert::FindTextBox(HWND hwnd, LPARAM arg) { HWND *dialog_handle = reinterpret_cast<HWND*>(arg); std::vector<wchar_t> child_window_class(100); ::GetClassName(hwnd, &child_window_class[0], 100); if (wcscmp(&child_window_class[0], L"Edit") == 0) { *dialog_handle = hwnd; return FALSE; } return TRUE; }
BOOL CALLBACK Alert::FindTextLabel(HWND hwnd, LPARAM arg) { TextLabelFindInfo* find_info = reinterpret_cast<TextLabelFindInfo*>(arg); std::vector<wchar_t> child_window_class(100); ::GetClassName(hwnd, &child_window_class[0], 100); if (wcscmp(&child_window_class[0], L"Static") != 0) { return TRUE; } int control_id = ::GetDlgCtrlID(hwnd); int text_length = ::GetWindowTextLength(hwnd); if (text_length > 0) { if (find_info->excluded_control_id == 0 || control_id != find_info->excluded_control_id) { find_info->label_handle = hwnd; find_info->control_id_found = control_id; return FALSE; } } return TRUE; }