void on_button_connect_clicked (void) { extern char username[]; extern char password[]; extern int username_length, password_length; if (Edit_GetModify (hwndEditUser) || Edit_GetModify (hwndEditPass)) { username_length = GetWindowTextLength(hwndEditUser); password_length = GetWindowTextLength(hwndEditPass); GetWindowText(hwndEditUser, username, username_length + 1); GetWindowText(hwndEditPass, password, password_length + 1); reg_info_string (reg_key, REG_KEY_USER, TRUE, username, NULL, 0); reg_info_string (reg_key, REG_KEY_PASS, TRUE, password, NULL, 0); } /* 记录网卡设备列表序列 */ reg_info_dword (reg_key, REG_KEY_IF_INDEX, TRUE, combo_index, NULL); /* 记录网卡设备列表名称 */ char combo_if_name[512] = {0}; ComboBox_GetLBText (hwndComboList, combo_index, combo_if_name); reg_info_string (reg_key, REG_KEY_IF_NAME, TRUE, combo_if_name, NULL, 0); /* 禁用几个控件 */ EnableWindow (hwndButtonConn, FALSE); EnableWindow (hwndEditUser, FALSE); EnableWindow (hwndEditPass, FALSE); EnableWindow (hwndComboList, FALSE); hEAP_THREAD = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)eap_thread, 0, 0, 0); }
/**************************************************************************** * text_QueryClose * Inputs: * HWND hwnd: Window handle * Result: BOOL * TRUE if window can close * FALSE if it can't * Effect: * If there is a change in the edit control, pops up a message box * asking for confirmation. ****************************************************************************/ int text_QueryClose( HWND hwnd) { BOOL modified = Edit_GetModify(GetDlgItem(hwnd,ID_EDIT_CONTROL)); TCHAR caption[256]; TCHAR changed[256]; if (! modified) { return IDNO; } VERIFY(LoadString(GetWindowInstance(hwnd), IDS_SAVE_CHANGES_CAPTION, caption, DIM(caption))); VERIFY(LoadString(GetWindowInstance(hwnd), IDS_SAVE_CHANGES, changed, DIM(changed))); // We use a more general structure here so that in the future, we // could issue a box that said "Save changes [Yes][No][Cancel]" and // do a multiway branch based on the three possible return values. return (MessageBox(hwnd, changed, caption, MB_ICONSTOP | MB_YESNOCANCEL)); }
FindThreadData(WindowInfo& win, TextSearchDirection direction, HWND findBox) : win(&win), direction(direction), text(win::GetText(findBox)), wasModified(Edit_GetModify(findBox)), wnd(NULL) { }