// Speedometer dialog UINT UtSpeedMeterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: SetIcon(hWnd, 0, ICO_NIC_ONLINE); UtSpeedMeterDlgInit(hWnd); SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); break; case WM_TIMER: switch (wParam) { case 1: KillTimer(hWnd, 1); UtSpeedMeterDlgRefreshStatus(hWnd); UtSpeedMeterDlgUpdate(hWnd); SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); break; } break; case WM_COMMAND: if (HIWORD(wParam) == CBN_SELCHANGE) { Free(selected_adapter); selected_adapter = GetTextA(hWnd, E_LIST); UtSpeedMeterDlgUpdate(hWnd); } else { switch (wParam) { case B_REFRESH: UtSpeedMeterDlgRefreshList(hWnd); Free(selected_adapter); selected_adapter = GetTextA(hWnd, E_LIST); UtSpeedMeterDlgUpdate(hWnd); break; case IDCANCEL: Close(hWnd); break; } } break; case WM_CLOSE: Free(selected_adapter); selected_adapter = NULL; EndDialog(hWnd, 0); break; } return 0; }
void WriteElement() { if (NULL == m_pCurrentNode) { m_pNode = new CXmlNodeBase(); m_pNode->m_pDocument = this; m_pNode->m_pDocument->AddRef(); m_pCurrentNode = m_pNode; } else { // это m_pCurrentNode CXmlNodeBase* pNewBase = new CXmlNodeBase(); pNewBase->m_pDocument = this; pNewBase->m_pDocument->AddRef(); m_pCurrentNode->m_nodes.insert(m_pCurrentNode->m_nodes.end(), pNewBase); m_pCurrentNode = pNewBase; } m_pCurrentNode->m_sName = GetName(); m_list.push_back(m_pCurrentNode); if (GetAttributesCount() > 0) { MoveToFirstAttribute(); CStringA sName = GetNameA(); while (!sName.IsEmpty()) { m_pCurrentNode->m_attributes.insert(std::make_pair(sName, GetTextA())); if ( !MoveToNextAttribute() ) break; sName = GetNameA(); } MoveToElement(); } if (IsEmptyNode()) { m_list.pop_back(); if (0 != m_list.size()) { std::list<CXmlNodeBase*>::iterator iter = m_list.end(); --iter; m_pCurrentNode = *iter; } else { m_pCurrentNode = m_pNode; } } }
// Make a text from the input data void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size) { char *k1, *k2, *k3, *k4, *k5, *k6; // Validate arguments if (hWnd == NULL || str == NULL) { return; } k1 = GetTextA(hWnd, B_KEY1); k2 = GetTextA(hWnd, B_KEY2); k3 = GetTextA(hWnd, B_KEY3); k4 = GetTextA(hWnd, B_KEY4); k5 = GetTextA(hWnd, B_KEY5); k6 = GetTextA(hWnd, B_KEY6); Format(str, size, "%s-%s-%s-%s-%s-%s", k1, k2, k3, k4, k5, k6); Free(k1); Free(k2); Free(k3); Free(k4); Free(k5); Free(k6); }
// Speedometer dialog initialization void UtSpeedMeterDlgInit(HWND hWnd) { // Validate arguments if (hWnd == NULL) { return; } LvInitEx(hWnd, L_STATUS, true); LvInsertColumn(hWnd, L_STATUS, 0, _UU("UT_SM_COLUMN_1"), 150); LvInsertColumn(hWnd, L_STATUS, 1, _UU("UT_SM_COLUMN_2"), 290); UtSpeedMeterDlgRefreshList(hWnd); selected_adapter = GetTextA(hWnd, E_LIST); UtSpeedMeterDlgRefreshStatus(hWnd); UtSpeedMeterDlgUpdate(hWnd); }
// Shift treatment of text input void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) { char *s; // Validate arguments if (hWnd == NULL || next_focus == NULL) { return; } s = GetTextA(hWnd, id1); if (StrLen(s) >= 6) { char *s2 = CopyStr(s); char tmp[MAX_SIZE]; s2[6] = 0; SetTextA(hWnd, id1, s2); Free(s2); if (id2 != 0) { GetTxtA(hWnd, id2, tmp, sizeof(tmp)); StrCat(tmp, sizeof(tmp), s + 6); ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); SetTextA(hWnd, id2, tmp); *next_focus = id2; } else { *next_focus = IDOK; } } Free(s); }
// Dialog proc for the push routing option UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { SM_HUB *r = (SM_HUB *)param; char *str = NULL; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: SetTextA(hWnd, E_TEXT, r->CurrentPushRouteStr); Focus(hWnd, E_TEXT); SetIcon(hWnd, 0, ICO_PROTOCOL); break; case WM_COMMAND: switch (wParam) { case IDOK: str = GetTextA(hWnd, E_TEXT); if (str != NULL) { bool ok = true; if (CheckClasslessRouteTableStr(str) == false) { if (MsgBox(hWnd, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2, _UU("NM_PUSH_ROUTE_WARNING")) == IDCANCEL) { ok = false; } } if (ok) { if (IsEmptyStr(str) == false) { if (GetCapsBool(r->p->CapsList, "b_suppport_push_route") == false) { MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("ERR_147")); } } StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), str); EndDialog(hWnd, 1); } Free(str); } break; case IDCANCEL: Close(hWnd); break; } break; case WM_CLOSE: EndDialog(hWnd, 0); break; } return 0; }