void DoRace(PCHAR szArg) { if (szArg[0] == 0) { MacroError("Bad race name."); return; } int index = -1; CHAR szRace[255] = { 0 }; if (isdigit(szArg[0])) { index = atoi(szArg); if (index == 0) { strcpy_s(szRace, "Any Race"); } else { for (int i = 0; i < sizeof(races) / sizeof(races[0]); i++) { if (races[i].race==index) { strcpy_s(szRace, races[i].name); break; } } } } else { for (int i = 0; i < sizeof(races) / sizeof(races[0]); i++) { if (!_stricmp(szArg, races[i].name)) { strcpy_s(szRace, szArg); break; } } } if (szRace[0] == '\0') { MacroError("Bad race name."); return; } if (!_stricmp(szArg, "any")) { strcpy_s(szRace, "Any Race"); } if (CComboWnd *pCombo = (CComboWnd *)pBazaarSearchWnd->GetChildItem("BZR_RaceSlotCombobox")) { if (CListWnd*pListWnd = (CListWnd*)pCombo->Items) { CXStr Str; CHAR szOut[255] = { 0 }; DWORD itemcnt = pCombo->GetItemCount(); for (DWORD i = 0; i < itemcnt; i++) { pListWnd->GetItemText(&Str, i, 0); GetCXStr(Str.Ptr, szOut, 254); if (szOut[0] != '\0') { if (!_stricmp(szRace, szOut)) { SetComboSelection((CSidlScreenWnd*)pCombo, i); break; } } } } } }
void DoClass(PCHAR szArg) { if (szArg[0] == 0) { MacroError("Bad class name."); return; } int index = -1; CHAR szClass[255] = { 0 }; if (isdigit(szArg[0])) { index = atoi(szArg); if (index == 0) { strcpy_s(szClass, "Any Class"); } else { for (int i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) { if (classes[i].classn==index) { strcpy_s(szClass, classes[i].name); break; } } } } else { for (int i = 0; i < sizeof(classes) / sizeof(classes[0]); i++) { if (!_stricmp(szArg, classes[i].name)) { strcpy_s(szClass, szArg); break; } } } if (szClass[0] == '\0') { MacroError("Bad class name."); return; } if (!_stricmp(szArg, "any")) { strcpy_s(szClass, "Any Class"); } if (CComboWnd *pCombo = (CComboWnd *)pBazaarSearchWnd->GetChildItem("BZR_ClassSlotCombobox")) { if (CListWnd*pListWnd = pCombo->pListWnd) { CXStr Str; CHAR szOut[MAX_STRING] = { 0 }; DWORD itemcnt = pCombo->GetItemCount(); for (DWORD i = 0; i < itemcnt; i++) { pListWnd->GetItemText(&Str, i, 0); GetCXStr(Str.Ptr, szOut, MAX_STRING); if (szOut[0] != '\0') { if (!_stricmp(szClass, szOut)) { SetComboSelection(pCombo, i); break; } } } } } }
void DoCombo(PCHAR szArg, PCHAR key, PCHAR szCombostring) { if (szArg[0] == 0) { MacroError("Bad %s name.", key); return; } DWORD index = -1; CHAR szValue[255] = { 0 }; if (isdigit(szArg[0])) { index = atoi(szArg); index--; } if (!_stricmp(szArg, "any")) { sprintf_s(szValue, "Any %s",key); } else { strcpy_s(szValue, szArg); } if (CComboWnd *pCombo = (CComboWnd *)pBazaarSearchWnd->GetChildItem(szCombostring)) { if (CListWnd*pListWnd = (CListWnd*)pCombo->Items) { CXStr Str; CHAR szOut[255] = { 0 }; DWORD itemcnt = pCombo->GetItemCount(); if (index != -1 && index <= itemcnt) { SetComboSelection((CSidlScreenWnd*)pCombo, index); } else { for (DWORD i = 0; i < itemcnt; i++) { pListWnd->GetItemText(&Str, i, 0); GetCXStr(Str.Ptr, szOut, 254); if (szOut[0] != '\0') { if (!_stricmp(szValue, szOut)) { SetComboSelection((CSidlScreenWnd*)pCombo, i); break; } } } } } } }
BOOL CNewTaskDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* pCombo; CBitmap bmp; CRect rectWnd; CRect rectTemp; m_nSignature = 0; m_bConnected = m_pOwner->IsConnected(); m_ilState.Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1); bmp.LoadBitmap(IDB_STATES); int i = m_ilState.Add(&bmp, RGB(255, 0, 255)); bmp.DeleteObject(); rectWnd.SetRectEmpty(); ::ImageList_GetIconSize(m_ilState, (int*)&rectWnd.right, (int*)&rectWnd.bottom); for (BYTE nCS = 0; nCS < MAX_CS; nCS++) { GetDlgItem(IDC_LABLE_CE0 + nCS)->GetWindowRect(rectTemp); ScreenToClient(rectTemp); rectWnd.MoveToXY(rectTemp.right+1, rectTemp.top-1); m_pStateCS[nCS] = new CStatic; m_pStateCS[nCS]->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON, rectWnd, this); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VCC); for (BYTE i = PowerIO_1_8; i < CountPowerIO; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPowerIO(i)), i); } SetComboSelection(pCombo, PowerIO_1_8); GetDlgItem(IDC_LABEL_RECORDS)->GetWindowRect(rectWnd); ScreenToClient(rectWnd); m_FlashParametersDlg.Create(this, rectWnd.TopLeft(), FALSE); m_FlashRecordsDlg.Create(this, rectWnd.TopLeft()); GetDlgItem(IDC_COMBO_VCC)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_CHECK)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_RESET)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ID)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_VENDOR)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ONFI)->EnableWindow(m_bConnected); ((CButton*)GetDlgItem(IDC_SELECT_BASE))->SetCheck(BST_CHECKED); OnSelectChange(IDC_SELECT_BASE); OnClickedBtnReset(); SetButtonOK(); return TRUE; }