static void PopulateForm(void) { int32_t i,j; char buf[64]; int32_t mode2d, mode3d; HWND hwnd2d, hwnd3d; hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); if (mode2d < 0) mode2d = 0; if (mode3d < 0) { int32_t cd[] = { 32, 24, 16, 15, 8, 0 }; for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } for (; cd[i]; i++) { mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); if (mode3d < 0) continue; settings.bpp3d = cd[i]; break; } } Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); (void)ComboBox_ResetContent(hwnd2d); (void)ComboBox_ResetContent(hwnd3d); for (i=0; i<validmodecnt; i++) { if (validmode[i].fs != settings.fullscreen) continue; // all modes get added to the 3D mode list Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); j = ComboBox_AddString(hwnd3d, buf); (void)ComboBox_SetItemData(hwnd3d, j, i); if (i == mode3d)(void)ComboBox_SetCurSel(hwnd3d, j); // only 8-bit modes get used for 2D if (validmode[i].bpp != 8 || validmode[i].xdim < 640 || validmode[i].ydim < 480) continue; Bsprintf(buf, "%d x %d", validmode[i].xdim, validmode[i].ydim); j = ComboBox_AddString(hwnd2d, buf); (void)ComboBox_SetItemData(hwnd2d, j, i); if (i == mode2d)(void)ComboBox_SetCurSel(hwnd2d, j); } }
void EnumDrives(HWND hW) { HWND hWC;char szB[256];int i=0,k=0,iNum; char * p, * pBuf, * pN; hWC=GetDlgItem(hW,IDC_DRIVE); ComboBox_ResetContent(hWC); ComboBox_AddString(hWC,"NONE"); // add always existing 'none' wsprintf(szB,"[%d:%d:%d",iCD_AD,iCD_TA,iCD_LU); // make current user info text pN=pBuf=(char *)malloc(32768); memset(pBuf,0,32768); iNum=GetGenCDDrives(pBuf); // get the system cd drives list for(i=0;i<iNum;i++) // loop drives { ComboBox_AddString(hWC,pN); // -> add drive name p=strchr(pN,']'); if(p) { *p=0; if(strcmp(szB,pN)==0) k=i+1; // -> is it the current user drive? sel it *p=']'; } pN+=strlen(pN)+1; // next drive in buffer } free(pBuf); ComboBox_SetCurSel(hWC,k); // do the drive sel }
void DSN_Set_Database(SQLHANDLE Connection) { MADB_Stmt *Stmt= NULL; SQLRETURN ret= SQL_ERROR; char Database[65]; MADB_Dsn *Dsn= (MADB_Dsn *)GetWindowLongPtr(GetParent(hwndTab[0]), DWLP_USER); if (DBFilled) return; GetDialogFields(); if (SQLAllocHandle(SQL_HANDLE_STMT, Connection, (SQLHANDLE *)&Stmt) != SQL_SUCCESS) goto end; if (SQLExecDirect((SQLHSTMT)Stmt, (SQLCHAR *)"SHOW DATABASES", SQL_NTS) != SQL_SUCCESS) goto end; SQLBindCol(Stmt, 1, SQL_C_CHAR, Database, 65, 0); ComboBox_ResetContent(GetDlgItem(hwndTab[1], cbDatabase)); while (SQLFetch(Stmt) == SQL_SUCCESS) ComboBox_InsertString(GetDlgItem(hwndTab[1], cbDatabase), -1, Database); if (Dsn->Catalog) { int Idx= ComboBox_FindString(GetDlgItem(hwndTab[2], cbDatabase), 0, Dsn->Catalog); ComboBox_SetCurSel(GetDlgItem(hwndTab[2], cbDatabase), Idx); } ComboBox_SetMinVisible(GetDlgItem(hwndTab[1], cbDatabase),5); DBFilled= TRUE; end: if (Stmt) SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE)Stmt); }
/** Processing commands for dbname combobox (hwndCtl). */ void processDbCombobox(HWND hwnd, HWND hwndCtl, UINT codeNotify) { switch(codeNotify) { /* Loading list and adjust its height if button clicked and on user input */ case(CBN_DROPDOWN): { FillParameters(hwnd, pParams); LIST *dbs= mygetdatabases(hwnd, pParams); LIST *dbtmp= dbs; ComboBox_ResetContent(hwndCtl); adjustDropdownHeight(hwndCtl,list_length(dbs)); for (; dbtmp; dbtmp= list_rest(dbtmp)) ComboBox_AddString(hwndCtl, (SQLWCHAR *)dbtmp->data); list_free(dbs, 1); ComboBox_SetText(hwndCtl,pParams->database); break; } } }
/** Processing commands for charset combobox (hwndCtl). */ void processCharsetCombobox(HWND hwnd, HWND hwndCtl, UINT codeNotify) { switch(codeNotify) { /* Loading list and adjust its height if button clicked and on user input */ case(CBN_DROPDOWN): { //FillParameters(hwnd, *pParams); LIST *csl= mygetcharsets(hwnd, pParams); LIST *cstmp= csl; ComboBox_ResetContent(hwndCtl); adjustDropdownHeight(hwndCtl,list_length(csl)); for (; cstmp; cstmp= list_rest(cstmp)) ComboBox_AddString(hwndCtl, (SQLWCHAR *)cstmp->data); list_free(csl, 1); ComboBox_SetText(hwndCtl,pParams->charset); break; } } }
void plNoteTrackDlg::ILoadAnims() { if(fAnimID < 0 || !fhAnim) return; ComboBox_ResetContent(fhAnim); // Add the default option int def = ComboBox_AddString(fhAnim, ENTIRE_ANIMATION_NAME); ComboBox_SetItemData(fhAnim, def, kDefault); ComboBox_SetCurSel(fhAnim, def); if (!fSegMap) return; const char *savedAnim = fPB->GetStr(fAnimID); if (!savedAnim) savedAnim = ""; // Add the names of the animations for (SegmentMap::iterator it = fSegMap->begin(); it != fSegMap->end(); it++) { SegmentSpec *spec = it->second; if (spec->fType == SegmentSpec::kAnim) { int idx = ComboBox_AddString(fhAnim, spec->fName.c_str()); ComboBox_SetItemData(fhAnim, idx, kName); // If this is the saved animation name, select it if (!spec->fName.Compare(savedAnim)) ComboBox_SetCurSel(fhAnim, idx); } } }
void SymbolMap::FillSymbolComboBox(HWND listbox,SymbolType symmask) { ShowWindow(listbox,SW_HIDE); ComboBox_ResetContent(listbox); //int style = GetWindowLong(listbox,GWL_STYLE); ComboBox_AddString(listbox,"(0x02000000)"); ComboBox_SetItemData(listbox,0,0x02000000); //ListBox_AddString(listbox,"(0x80002000)"); //ListBox_SetItemData(listbox,1,0x80002000); SendMessage(listbox, WM_SETREDRAW, FALSE, 0); SendMessage(listbox, CB_INITSTORAGE, (WPARAM)entries.size(), (LPARAM)entries.size() * 30); for (size_t i = 0; i < entries.size(); i++) { if (entries[i].type & symmask) { char temp[256]; sprintf(temp,"%s (%d)",entries[i].name,entries[i].size); int index = ComboBox_AddString(listbox,temp); ComboBox_SetItemData(listbox,index,entries[i].vaddress); } } SendMessage(listbox, WM_SETREDRAW, TRUE, 0); RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); ShowWindow(listbox,SW_SHOW); }
/// <summary> /// Retrieve process threads /// </summary> /// <returns>Error code</returns> DWORD MainDlg::FillThreads() { HWND hCombo = GetDlgItem( _hMainDlg, IDC_THREADS ); int idx = 0; ComboBox_ResetContent( hCombo ); auto tMain = _proc.threads().getMain(); if (!tMain) return ERROR_NOT_FOUND; // Fake 'New thread' idx = ComboBox_AddString( hCombo, L"New thread" ); ComboBox_SetItemData( hCombo, idx, 0 ); ComboBox_SetCurSel( hCombo, idx ); for (auto& thd : _proc.threads().getAll( true )) { wchar_t text[255] = { 0 }; if (thd == *tMain) swprintf_s( text, L"Thread %d (Main)", thd.id() ); else swprintf_s( text, L"Thread %d", thd.id() ); idx = ComboBox_AddString( hCombo, text ); ComboBox_SetItemData( hCombo, idx, thd.id() ); } return 0; }
/// <summary> /// Enumerate processes /// </summary> /// <returns>Error code</returns> DWORD MainDlg::FillProcessList() { PROCESSENTRY32W pe32 = { 0 }; pe32.dwSize = sizeof(pe32); HWND hCombo = GetDlgItem( _hMainDlg, IDC_COMBO_PROC ); ComboBox_ResetContent( hCombo ); HANDLE hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); if (hSnap == NULL) return GetLastError(); for (BOOL res = Process32FirstW( hSnap, &pe32 ); res; res = Process32NextW( hSnap, &pe32 )) { wchar_t text[255] = { 0 }; swprintf_s( text, L"%ls (%d)", pe32.szExeFile, pe32.th32ProcessID ); int idx = ComboBox_AddString( hCombo, text ); ComboBox_SetItemData( hCombo, idx, pe32.th32ProcessID ); } CloseHandle( hSnap ); return 0; }
void plMtlAnimProc::ILoadAnimCombo(HWND hWnd, IParamBlock2* pb) { HWND hAnim = GetDlgItem(hWnd, fAnimComboID); ComboBox_ResetContent(hAnim); int sel = ComboBox_AddString(hAnim, ENTIRE_ANIMATION_NAME); ComboBox_SetCurSel(hAnim, sel); const char* savedName = pb->GetStr(fAnimParamID); if (!savedName) savedName = ""; Mtl* mtl = IGetMtl(pb); if (mtl) { plNotetrackAnim anim(mtl, nil); plString animName; while (!(animName = anim.GetNextAnimName()).IsNull()) { int idx = ComboBox_AddString(hAnim, animName.c_str()); ComboBox_SetItemData(hAnim, idx, 1); if (!animName.Compare(savedName)) ComboBox_SetCurSel(hAnim, idx); } EnableWindow(hAnim, TRUE); } else EnableWindow(hAnim, FALSE); // Update the dependencies of this ILoadUser(hWnd, pb); }
void CComWnd::com_update_item_list() { list_callback_ud ud; ud.that = this; struct { list_callback_ud::e_type type; i_com_list* plist; HWND hwnd; } ups[] = { {list_callback_ud::e_type::cp, _comm.comports()->update_list() , _hCP}, {list_callback_ud::e_type::br, _comm.baudrates()->update_list() , _hBR}, {list_callback_ud::e_type::pa, _comm.parities()->update_list() , _hPA}, {list_callback_ud::e_type::sb, _comm.stopbits()->update_list() , _hSB}, {list_callback_ud::e_type::db, _comm.databits()->update_list() , _hDB}, }; for(int i=0; i<sizeof(ups)/sizeof(*ups); i++){ ud.type = ups[i].type; ud.hwnd = ups[i].hwnd; ComboBox_ResetContent(ud.hwnd); ups[i].plist->callback(&CComWnd::com_udpate_list_callback, &ud); if (ComboBox_GetCount(ud.hwnd) > 0){ ComboBox_SetCurSel(ud.hwnd, 0); } } int ii = ComboBox_InsertString(_hBR, -1, "<输入>"); ComboBox_SetItemData(_hBR, ii, 1); // 1 - 自定义 }
void SymbolMap::FillSymbolComboBox(HWND listbox,SymbolType symmask) { ShowWindow(listbox,SW_HIDE); ComboBox_ResetContent(listbox); //int style = GetWindowLong(listbox,GWL_STYLE); ComboBox_AddString(listbox,"(0x02000000)"); ComboBox_SetItemData(listbox,0,0x02000000); //ListBox_AddString(listbox,"(0x80002000)"); //ListBox_SetItemData(listbox,1,0x80002000); for (size_t i = 0; i < entries.size(); i++) { if (entries[i].type & symmask) { char temp[256]; sprintf(temp,"%s (%d)",entries[i].name,entries[i].size); int index = ComboBox_AddString(listbox,temp); ComboBox_SetItemData(listbox,index,entries[i].vaddress); } } ShowWindow(listbox,SW_SHOW); }
bool CWinCombo::ResetContent() { if(m_Hwnd) { ComboBox_ResetContent(m_Hwnd); return true; } else return false; }
void CAtmoLiveSettings::LoadDisplayList() { CAtmoDisplays *pAtmoDisplays = this->m_pDynData->getAtmoDisplays(); HWND hwndCtrl; hwndCtrl = getDlgItem(IDC_DISPLAYS); ComboBox_ResetContent(hwndCtrl); for(int i=0;i<pAtmoDisplays->getCount();i++) { TAtmoDisplayInfo nfo = pAtmoDisplays->getDisplayInfo(i); ComboBox_AddString(hwndCtrl, nfo.infoText); } ComboBox_SetCurSel(hwndCtrl, m_pDynData->getAtmoConfig()->getLiveView_DisplayNr()); }
void ILoadCombo(HWND hWnd, int ctrlID, int paramID, IParamBlock2* pb, plNotetrackAnim& anim) { const char* savedName = pb->GetStr(paramID); HWND hCombo = GetDlgItem(hWnd, ctrlID); ComboBox_ResetContent(hCombo); plString animName; while (!(animName = anim.GetNextAnimName()).IsNull()) { int sel = ComboBox_AddString(hCombo, animName.c_str()); if (animName.Compare(savedName) == 0) ComboBox_SetCurSel(hCombo, sel); } }
void plResponderWaitProc::LoadWho(bool setDefault) { HWND hWho = GetDlgItem(fhDlg, IDC_WAIT_WHO); int who = fWaitPB->GetInt(kWaitWho); ComboBox_ResetContent(hWho); int numFound = 0; // Copy all the commands before this one to the 'who' combo box for (int i = 0; i < fCurCmd; i++) { IParamBlock2 *pb = GetCmdParams(i); plResponderCmd *cmd = plResponderCmd::Find(pb); if (cmd->IsWaitable(pb)) { int idx = ComboBox_AddString(hWho, cmd->GetInstanceName(pb)); ComboBox_SetItemData(hWho, idx, i); // If the saved 'who' is valid, select it and check the wait checkbox if (who == i) { ComboBox_SetCurSel(hWho, idx); CheckDlgButton(fhDlg, IDC_CHECK_WAIT, BST_CHECKED); EnableWindow(hWho, TRUE); } numFound++; } } // Pick the last item in the who combo as the default if (setDefault && numFound > 0) { HWND hWho = GetDlgItem(fhDlg, IDC_WAIT_WHO); int idx = ComboBox_GetItemData(hWho, numFound-1); fWaitPB->SetValue(kWaitWho, 0, idx); ComboBox_SetCurSel(hWho, numFound-1); CheckDlgButton(fhDlg, IDC_CHECK_WAIT, BST_CHECKED); EnableWindow(hWho, TRUE); } // Disable the wait checkbox if there are no waitable commands behind this one EnableWindow(GetDlgItem(fhDlg, IDC_CHECK_WAIT), (numFound > 0)); }
/// <summary> /// Load selected image and do some validation /// </summary> /// <param name="path">Full qualified image path</param> /// <returns>Error code</returns> DWORD MainDlg::LoadImageFile( const wchar_t* path ) { HWND hCombo = GetDlgItem( _hMainDlg, IDC_INIT_EXPORT ); ComboBox_ResetContent( hCombo ); // Check if image is a PE file if (_file.Project( path ) == nullptr || _imagePE.Parse( _file.base(), _file.isPlainData() ) == false) { DWORD err = GetLastError(); std::wstring errstr = std::wstring( L"File \"" ) + path + L"\" is not a valid PE image"; Edit_SetText( GetDlgItem( _hMainDlg, IDC_IMAGE_PATH ), L"" ); MessageBoxW( _hMainDlg, errstr.c_str(), L"Error", MB_ICONERROR ); _file.Release(); return err; } // In case of pure IL, list all methods if (_imagePE.IsPureManaged( )) { if (_imagePE.net().Init( path )) { blackbone::ImageNET::mapMethodRVA methods; _imagePE.net().Parse( methods ); for (auto& entry : methods) { std::wstring name = entry.first.first + L"." + entry.first.second; SendMessageW( hCombo, CB_ADDSTRING, 0L, (LPARAM)name.c_str() ); } } } // Simple exports otherwise else { std::list<std::string> names; _imagePE.GetExportNames( names ); for (auto& name : names) SendMessageA( hCombo, CB_ADDSTRING, 0L, (LPARAM)name.c_str() ); } return 0; }
static void populateVideoModes(BOOL firstTime) { int i, j, mode3d, fullscreen; int xdim, ydim, bpp = 8; char buf[64]; HWND hwnd; fullscreen = IsDlgButtonChecked(pages[TAB_CONFIG], IDC_FULLSCREEN) == BST_CHECKED; hwnd = GetDlgItem(pages[TAB_CONFIG], IDC_3DVMODE); if (firstTime) { xdim = settings.xdim3d; ydim = settings.ydim3d; bpp = settings.bpp3d; } else { i = ComboBox_GetCurSel(hwnd); if (i != CB_ERR) i = ComboBox_GetItemData(hwnd, i); if (i != CB_ERR) { xdim = validmode[i].xdim; ydim = validmode[i].ydim; bpp = validmode[i].bpp; } } mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1); if (mode3d < 0) { int i, cd[] = { 32, 24, 16, 15, 8, 0 }; for (i=0; cd[i]; ) { if (cd[i] >= bpp) i++; else break; } for ( ; cd[i]; i++) { mode3d = checkvideomode(&xdim, &ydim, cd[i], fullscreen, 1); if (mode3d < 0) continue; break; } } ComboBox_ResetContent(hwnd); for (i=0; i<validmodecnt; i++) { if (validmode[i].fs != fullscreen) continue; Bsprintf(buf, "%d x %d %d-bpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); j = ComboBox_AddString(hwnd, buf); ComboBox_SetItemData(hwnd, j, i); if (i == mode3d) { ComboBox_SetCurSel(hwnd, j); } } }
void plNoteTrackDlg::ILoadLoops() { if(fLoopID < 0 || !fhLoop) return; ComboBox_ResetContent(fhLoop); // Add the default option int def = ComboBox_AddString(fhLoop, ENTIRE_ANIMATION_NAME); ComboBox_SetItemData(fhLoop, def, kDefault); ComboBox_SetCurSel(fhLoop, def); if (fSegMap) { // Get the animation segment (or leave it nil if we're using the entire animation) SegmentSpec *animSpec = nil; plString animName = plString::FromUtf8(fPB->GetStr(fAnimID)); if (!animName.IsEmpty() && fSegMap->find(animName) != fSegMap->end()) animSpec = (*fSegMap)[animName]; // Get the saved loop name const char *loopName = fPB->GetStr(fLoopID); if (!loopName) loopName = ""; for (SegmentMap::iterator i = fSegMap->begin(); i != fSegMap->end(); i++) { SegmentSpec *spec = i->second; if (spec->fType == SegmentSpec::kLoop) { // If the loop is contained by the animation, add it if (!animSpec || animSpec->Contains(spec)) { // Add the name int idx = ComboBox_AddString(fhLoop, spec->fName.c_str()); ComboBox_SetItemData(fhLoop, idx, kName); if (!spec->fName.Compare(loopName)) ComboBox_SetCurSel(fhLoop, idx); } } } } }
VOID Dlg_PopulateModuleList(HWND hwnd) { HWND hwndModuleHelp = GetDlgItem(hwnd, IDC_MODULEHELP); ListBox_ResetContent(hwndModuleHelp); CToolhelp thProcesses(TH32CS_SNAPPROCESS); PROCESSENTRY32 pe = { sizeof(pe) }; BOOL fOk = thProcesses.ProcessFirst(&pe); for (; fOk; fOk = thProcesses.ProcessNext(&pe)) { CToolhelp thModules(TH32CS_SNAPMODULE, pe.th32ProcessID); MODULEENTRY32 me = { sizeof(me) }; BOOL fOk = thModules.ModuleFirst(&me); for (; fOk; fOk = thModules.ModuleNext(&me)) { int n = ListBox_FindStringExact(hwndModuleHelp, -1, me.szExePath); if (n == LB_ERR) { // This module hasn't been added before ListBox_AddString(hwndModuleHelp, me.szExePath); } } } HWND hwndList = GetDlgItem(hwnd, IDC_PROCESSMODULELIST); SetWindowRedraw(hwndList, FALSE); ComboBox_ResetContent(hwndList); int nNumModules = ListBox_GetCount(hwndModuleHelp); for (int i = 0; i < nNumModules; i++) { TCHAR sz[1024]; ListBox_GetText(hwndModuleHelp, i, sz); // Place module name (without its path) in the list int nIndex = ComboBox_AddString(hwndList, _tcsrchr(sz, TEXT('\\')) + 1); // Associate the index of the full path with the added item ComboBox_SetItemData(hwndList, nIndex, i); } ComboBox_SetCurSel(hwndList, 0); // Select the first entry // Simulate the user selecting this first item so that the // results pane shows something interesting FORWARD_WM_COMMAND(hwnd, IDC_PROCESSMODULELIST, hwndList, CBN_SELCHANGE, SendMessage); SetWindowRedraw(hwndList, TRUE); InvalidateRect(hwndList, NULL, FALSE); }
void plResponderAnimProc::ILoadUser(HWND hWnd, IParamBlock2 *pb) { // Premptive strike. If this isn't a loop, don't bother! int type = pb->GetInt(kRespAnimType); if (type != kRespondLoopAnimOn) return; HWND hLoop = GetDlgItem(hWnd, IDC_LOOP_COMBO); const char *savedName = pb->GetStr(kAnimLoop); if (!savedName) savedName = ""; // Reset the combo and add the default selection ComboBox_ResetContent(hLoop); int sel = ComboBox_AddString(hLoop, ENTIRE_ANIMATION_NAME); ComboBox_SetCurSel(hLoop, sel); // FIXME plComponentBase *comp = plResponderCmdAnim::Instance().GetComponent(pb); if (comp && comp->ClassID() == ANIM_COMP_CID) { plString animName = ((plAnimComponent*)comp)->GetAnimName(); // Get the shared animations for all the nodes this component is applied to plNotetrackAnim anim(comp, nil); plAnimInfo info = anim.GetAnimInfo(animName); // Get all the loops in this animation plString loopName; while (!(loopName = info.GetNextLoopName()).IsNull()) { int idx = ComboBox_AddString(hLoop, loopName.c_str()); ComboBox_SetItemData(hLoop, idx, 1); if (!loopName.Compare(savedName)) ComboBox_SetCurSel(hLoop, idx); } EnableWindow(hLoop, TRUE); } else { EnableWindow(hLoop, FALSE); } }
void tintegrate2::refresh(HWND hdlgP) { fill_formaters(); Button_SetText(GetDlgItem(hdlgP, IDC_BT_INTEGRATE_CONVERT), utf8_2_ansi(_("Convert to"))); std::stringstream strstr; HWND hctl = GetDlgItem(hdlgP, IDC_CMB_INTEGRATE_FORMATER); ComboBox_ResetContent(hctl); for (std::vector<tformater>::const_iterator it = formaters.begin(); it != formaters.end(); ++ it) { const tformater& formater = *it; strstr.str(""); strstr << utf8_2_ansi(formater.name) << " <=====> "; strstr << formater.example; ComboBox_AddString(hctl, strstr.str().c_str()); } ComboBox_SetCurSel(hctl, 0); }
void sync_enter_ui(void) { StatusBar_Trans(); // 保留给将来使用按钮,当前版本全都灰掉 ToolBar_EnableButton(gdmgr._htb_sync, IDM_REFRESH, TRUE); ToolBar_EnableButton(gdmgr._htb_sync, IDM_SYNC_SYNC, FALSE); HWND hctl = GetDlgItem(gdmgr._htb_sync, IDC_CMB_SYNC_LANGUAGE); ComboBox_ResetContent(hctl); const std::vector<language_def>& languages = get_languages(); const language_def& current_language = get_language(); BOOST_FOREACH (const language_def& lang, languages) { ComboBox_AddString(hctl, utf8_2_ansi(lang.language.c_str())); if (lang == current_language) { ComboBox_SetCurSel(hctl, ComboBox_GetCount(hctl) - 1); } }
void CMemoryDlg::NotifyMapLoaded() { if (m_hDlg) { HWND list = GetDlgItem(m_hDlg,IDC_SYMBOLS); symbolMap.FillSymbolListBox(list,ST_DATA); HWND lb = GetDlgItem(m_hDlg,IDC_REGIONS); int sel = ComboBox_GetCurSel(lb); ComboBox_ResetContent(lb); /* for (int i = 0; i < cpu->getMemMap()->numRegions; i++) { int n = ComboBox_AddString(lb,cpu->getMemMap()->regions[i].name); ComboBox_SetItemData(lb,n,cpu->getMemMap()->regions[i].start); }*/ ComboBox_SetCurSel(lb,sel>=0?sel:0); } Update(); }
/**************************************************************************** * * * Functions: FormMain_OnCommand related event code * * * * Purpose : Handle WM_COMMAND messages: this is the heart of the app. * * * * History : Date Reason * * 00/00/00 Created * * * ****************************************************************************/ void btnDetails_Click (HWND hwnd) { RECT rect; GetWindowRect( hwnd, &rect ); mod *= -1; ShowWindow( GetDlgItem(hwnd,IDC_TAB1), mod > 0? SW_SHOW: SW_HIDE ); if(!flag && mod==1) { static PWSTR tabnames[]= {L"Connection", L"Metadata", L"Cursors/Results", L"Debug", L"SSL", L"Misc", 0}; static PWSTR dlgnames[]= {MAKEINTRESOURCE(IDD_TAB1), MAKEINTRESOURCE(IDD_TAB2), MAKEINTRESOURCE(IDD_TAB3), MAKEINTRESOURCE(IDD_TAB4), MAKEINTRESOURCE(IDD_TAB5), MAKEINTRESOURCE(IDD_TAB6),0}; New_TabControl( &TabCtrl_1, // address of TabControl struct GetDlgItem(hwnd, IDC_TAB1), // handle to tab control tabnames, // text for each tab dlgnames, // dialog id's of each tab page dialog &FormMain_DlgProc, // address of main windows proc NULL, // address of size function TRUE); // stretch tab page to fit tab ctrl flag = true; HWND ssl_tab = TabCtrl_1.hTabPages[4]; HWND combo = GetDlgItem(ssl_tab, IDC_EDIT_sslmode); ComboBox_ResetContent(combo); ComboBox_AddString(combo, L""); ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_DISABLED)); ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_PREFERRED)); ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_REQUIRED)); ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_VERIFY_CA)); ComboBox_AddString(combo, LSTR(ODBC_SSL_MODE_VERIFY_IDENTITY)); syncTabs(hwnd, pParams); } MoveWindow( hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + 310*mod, TRUE ); }
/* This function fills the specified combo box with a list of all * signatures. */ void FASTCALL FillSignatureList( HWND hwnd, int id ) { register int n; FINDDATA ft; HWND hwndList; HFIND r; VERIFY( hwndList = GetDlgItem( hwnd, id ) ); ComboBox_ResetContent( hwndList ); for( n = r = AmFindFirst( "*.sig", DSD_SIG, _A_NORMAL, &ft ); n != -1; n = Amuser_FindNext( r, &ft ) ) { register int i; for( i = 0; ft.name[ i ] && ft.name[ i ] != '.'; ++i ); ft.name[ i ] = '\0'; ComboBox_AddString( hwndList, ft.name ); } Amuser_FindClose( r ); ComboBox_InsertString( hwndList, 0, GS(IDS_STR946) ); }
/*------------------------------------------------ --------------------------------------------------*/ void SetComboFontSize(HWND hDlg, BOOL bInit) { HDC hdc; wchar_t font[LF_FACESIZE]; DWORD size; LOGFONT lf = {0}; HWND size_cb = GetDlgItem(hDlg, IDC_FONTSIZE); HWND font_cb = GetDlgItem(hDlg, IDC_FONT); int pos; // remember old size if(bInit) { // on WM_INITDIALOG size = api.GetInt(L"Clock", L"FontSize", 9); if(!size || size>100) size = 9; } else { // when IDC_FONT has been changed ComboBox_GetText(size_cb, font, _countof(font)); size = _wtoi(font); } ComboBox_ResetContent(size_cb); hdc = GetDC(NULL); m_logpixelsy = GetDeviceCaps(hdc, LOGPIXELSY); ComboBox_GetLBText(font_cb, ComboBox_GetCurSel(font_cb), font); wcscpy(lf.lfFaceName, font); lf.lfCharSet = DEFAULT_CHARSET; EnumFontFamiliesEx(hdc, &lf, EnumSizeProcEx, (LPARAM)size_cb, 0); ReleaseDC(NULL, hdc); wsprintf(font, FMT("%d"), size); pos = ComboBox_FindStringExact(size_cb, -1, font); if(pos != LB_ERR) { ComboBox_SetCurSel(size_cb, pos); return; } ComboBox_SetText(size_cb, font); }
void DSN_Set_CharacterSets(SQLHANDLE Connection) { MADB_Stmt *Stmt= NULL; SQLRETURN ret= SQL_ERROR; char Charset[65]; MADB_Dsn *Dsn= (MADB_Dsn *)GetWindowLongPtr(GetParent(hwndTab[0]), DWLP_USER); if (CSFilled) return; GetDialogFields(); if (SQLAllocHandle(SQL_HANDLE_STMT, Connection, (SQLHANDLE *)&Stmt) != SQL_SUCCESS) goto end; if (SQLExecDirect((SQLHSTMT)Stmt, (SQLCHAR *)"select character_set_name from information_schema.collations " "WHERE character_set_name NOT LIKE 'utf16%' AND " "character_set_name NOT LIKE 'utf32%' AND " "character_set_name NOT LIKE 'ucs2' " "group by character_set_name order by character_set_name" , SQL_NTS) != SQL_SUCCESS) goto end; SQLBindCol(Stmt, 1, SQL_C_CHAR, Charset, 65, 0); ComboBox_ResetContent(GetDlgItem(hwndTab[2], cbCharset)); while (SQLFetch(Stmt) == SQL_SUCCESS) ComboBox_InsertString(GetDlgItem(hwndTab[2], cbCharset), -1, Charset); if (Dsn->CharacterSet) { int Idx= ComboBox_FindString(GetDlgItem(hwndTab[2], cbCharset), 0, Dsn->CharacterSet); ComboBox_SetCurSel(GetDlgItem(hwndTab[2], cbCharset), Idx); } ComboBox_SetMinVisible(GetDlgItem(hwndTab[2], cbCharset),5); CSFilled= TRUE; end: if (Stmt) SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE)Stmt); }
void CEpgDataCap_BonDlg::ReloadBonDriver() { this->bonList.clear(); ComboBox_ResetContent(GetDlgItem(IDC_COMBO_TUNER)); this->bonList = this->main.EnumBonDriver(); int selectIndex = 0; vector<wstring>::iterator itr; for( itr = this->bonList.begin(); itr != this->bonList.end(); itr++ ){ int index = ComboBox_AddString(GetDlgItem(IDC_COMBO_TUNER), itr->c_str()); if( this->iniBonDriver.empty() == false ){ if( this->iniBonDriver.compare(*itr) == 0 ){ selectIndex = index; } } } if( this->bonList.size() > 0){ ComboBox_SetCurSel(GetDlgItem(IDC_COMBO_TUNER), selectIndex); } }
void tab_appearance_fonts::update_mode_combobox() { ComboBox_ResetContent(m_wnd_colours_mode); t_size index; t_size index_element = ComboBox_GetCurSel(m_wnd_colours_element); if (index_element <= 1) { index = ComboBox_AddString(m_wnd_colours_mode, L"System"); ComboBox_SetItemData(m_wnd_colours_mode, index, cui::fonts::font_mode_system); } else { index = ComboBox_AddString(m_wnd_colours_mode, L"Common (list items)"); ComboBox_SetItemData(m_wnd_colours_mode, index, cui::fonts::font_mode_common_items); index = ComboBox_AddString(m_wnd_colours_mode, L"Common (labels)"); ComboBox_SetItemData(m_wnd_colours_mode, index, cui::fonts::font_mode_common_labels); } index = ComboBox_AddString(m_wnd_colours_mode, L"Custom"); ComboBox_SetItemData(m_wnd_colours_mode, index, cui::fonts::font_mode_custom); ComboBox_SetCurSel(m_wnd_colours_mode, win32_helpers::combobox_find_item_by_data(m_wnd_colours_mode, m_element_ptr->font_mode)); }