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 OnInitDialog(HWND hW) { char *dev; //int i; LoadConf(); ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "Expansion"); ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "PC Card"); for (int j=0;j<2;j++) { for (int i=0; i<pcap_io_get_dev_num(); i++) { dev = pcap_io_get_dev_desc(i,j); int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), dev); ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup(pcap_io_get_dev_name(i,j))); if (strcmp(pcap_io_get_dev_name(i,j), config.Eth) == 0) { ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm); } } } vector<tap_adapter> * al=GetTapAdapters(); for (size_t i=0; i<al->size(); i++) { int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str()); ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup( al[0][i].guid.c_str())); if (strcmp(al[0][i].guid.c_str(), config.Eth) == 0) { ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm); } } Edit_SetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd); Button_SetCheck(GetDlgItem(hW, IDC_ETHENABLED), config.ethEnable); Button_SetCheck(GetDlgItem(hW, IDC_HDDENABLED), config.hddEnable); }
/// <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; }
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); }
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); }
void CDialogInstall::TabContents::Create(HWND owner) { Tab::CreateTabWindow(10, 50, 380, 135, owner); static const ControlTemplate::Control s_Controls[] = { CT_LABEL(-1, 6, 0, 3, 107, 9, WS_VISIBLE, 0), CT_COMBOBOX(Id_LanguageComboBox, 0, 107, 0, 222, 14, WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL, 0), CT_LABEL(-1, 17, 0, 21, 107, 9, WS_VISIBLE, 0), CT_COMBOBOX(Id_InstallationTypeComboBox, 0, 107, 18, 222, 14, WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | WS_VSCROLL, 0), CT_LABEL(-1, 7, 0, 43, 107, 9, WS_VISIBLE, 0), CT_EDIT(Id_DestinationEdit, 14, 107, 40, 192, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY, WS_EX_CLIENTEDGE), CT_BUTTON(Id_DestinationBrowseButton, 9, 303, 40, 25, 14, WS_VISIBLE | WS_TABSTOP, 0), CT_CHECKBOX(Id_LaunchOnLoginCheckBox, 10, 0, 69, 250, 9, WS_VISIBLE | WS_TABSTOP, 0), }; CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString); HWND item = GetControl(Id_LanguageComboBox); ComboBox_AddString(item, L"English - English (United States)"); ComboBox_SetCurSel(item, 0); item = GetControl(Id_InstallationTypeComboBox); ComboBox_AddString(item, L"Standard 64-bit installation (reccomended)"); ComboBox_SetItemData(item, 0, MAKELPARAM(InstallType::Standard, InstallArch::X64)); ComboBox_AddString(item, L"Standard 32-bit installation"); ComboBox_SetItemData(item, 1, MAKELPARAM(InstallType::Standard, InstallArch::X32)); ComboBox_AddString(item, L"Portable 64-bit installation"); ComboBox_SetItemData(item, 2, MAKELPARAM(InstallType::Portable, InstallArch::X64)); ComboBox_AddString(item, L"Portable 32-bit installation"); ComboBox_SetItemData(item, 3, MAKELPARAM(InstallType::Portable, InstallArch::X32)); ComboBox_SetCurSel(item, 0); }
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); } }
/***************************************************************************** * ModuleConfigControl implementation *****************************************************************************/ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, module_config_t *p_item, HWND parent, HINSTANCE hInst, int * py_pos ) : ConfigControl( p_this, p_item, parent, hInst ) { module_t **p_list; module_t *p_parser; label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text), WS_CHILD | WS_VISIBLE | SS_LEFT, 5, *py_pos, 200, 15, parent, NULL, hInst, NULL ); *py_pos += 15 + 10; combo = CreateWindow( _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL, 20, *py_pos, 180, 5*15 + 6, parent, NULL, hInst, NULL); *py_pos += 15 + 10; /* build a list of available modules */ p_list = module_list_get( NULL ); ComboBox_AddString( combo, _T("Default") ); ComboBox_SetItemData( combo, 0, (void *)NULL ); ComboBox_SetCurSel( combo, 0 ); //ComboBox_SetText( combo, _T("Default") ); for( size_t i_index = 0; p_list[i_index]; i_index++ ) { p_parser = p_list[i_index]; if( module_provides( p_parser, p_item->psz_type ) ) { ComboBox_AddString( combo, _FROMMB(module_GetLongName( p_parser ) )); ComboBox_SetItemData( combo, i_index, (void *) module_get_object( p_parser ) ); if( p_item->value.psz && !strcmp( p_item->value.psz, module_get_object( p_parser )) ) { ComboBox_SetCurSel( combo, i_index ); //ComboBox_SetText( combo, _FROMMB( module_GetLongName(p_parser)) ); } } } module_list_free( p_list ); }
/***************************************************************************** * ModuleConfigControl implementation *****************************************************************************/ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, module_config_t *p_item, HWND parent, HINSTANCE hInst, int * py_pos ) : ConfigControl( p_this, p_item, parent, hInst ) { vlc_list_t *p_list; module_t *p_parser; label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text), WS_CHILD | WS_VISIBLE | SS_LEFT, 5, *py_pos, 200, 15, parent, NULL, hInst, NULL ); *py_pos += 15 + 10; combo = CreateWindow( _T("COMBOBOX"), _T(""), WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL, 20, *py_pos, 180, 5*15 + 6, parent, NULL, hInst, NULL); *py_pos += 15 + 10; /* build a list of available modules */ p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); ComboBox_AddString( combo, _T("Default") ); ComboBox_SetItemData( combo, 0, (void *)NULL ); ComboBox_SetCurSel( combo, 0 ); //ComboBox_SetText( combo, _T("Default") ); for( int i_index = 0; i_index < p_list->i_count; i_index++ ) { p_parser = (module_t *)p_list->p_values[i_index].p_object ; if( !strcmp( p_parser->psz_capability, p_item->psz_type ) ) { ComboBox_AddString( combo, _FROMMB(p_parser->psz_longname) ); ComboBox_SetItemData( combo, i_index, (void*)p_parser->psz_object_name ); if( p_item->psz_value && !strcmp(p_item->psz_value, p_parser->psz_object_name) ) { ComboBox_SetCurSel( combo, i_index ); //ComboBox_SetText( combo, _FROMMB(p_parser->psz_longname) ); } } } vlc_list_release( p_list ); }
//================================================================================================ //------------------------//----------------------------------+++--> Initialize the "Timer" Dialog: void OnInit(HWND hDlg) //-----------------------------------------------------------------+++--> { HWND timer_cb = GetDlgItem(hDlg, IDC_TIMERNAME); HWND file_cb = GetDlgItem(hDlg, IDC_TIMERFILE); char subkey[TNY_BUFF]; size_t offset; int idx, count; timeropt_t* pts; SendMessage(hDlg, WM_SETICON, ICON_SMALL,(LPARAM)g_hIconTClock); SendMessage(hDlg, WM_SETICON, ICON_BIG,(LPARAM)g_hIconTClock); // init dialog items SendDlgItemMessage(hDlg, IDC_TIMERSECSPIN, UDM_SETRANGE32, 0,59); // 60 Seconds Max SendDlgItemMessage(hDlg, IDC_TIMERMINSPIN, UDM_SETRANGE32, 0,59); // 60 Minutes Max SendDlgItemMessage(hDlg, IDC_TIMERHORSPIN, UDM_SETRANGE32, 0,23); // 24 Hours Max SendDlgItemMessage(hDlg, IDC_TIMERDAYSPIN, UDM_SETRANGE32, 0,7); // 7 Days Max /// add default sound files to file dropdown ComboBoxArray_AddSoundFiles(&file_cb, 1); // add timer to combobox offset=wsprintf(subkey,"%s\\Timer",g_szTimersSubKey); count=api.GetInt(g_szTimersSubKey, "NumberOfTimers", 0); for(idx=0; idx<count; ++idx) { pts = (timeropt_t*)malloc(sizeof(timeropt_t)); wsprintf(subkey+offset,"%d",idx+1); pts->second = api.GetInt(subkey, "Seconds", 0); pts->minute = api.GetInt(subkey, "Minutes", 10); pts->hour = api.GetInt(subkey, "Hours", 0); pts->day = api.GetInt(subkey, "Days", 0); api.GetStr(subkey, "Name", pts->name, sizeof(pts->name), ""); api.GetStr(subkey, "File", pts->fname, sizeof(pts->fname), ""); pts->bBlink = (char)api.GetInt(subkey, "Blink", FALSE); pts->bRepeat = (char)api.GetInt(subkey, "Repeat", FALSE); pts->bActive = (char)api.GetInt(subkey, "Active", FALSE); ComboBox_AddString(timer_cb, pts->name); ComboBox_SetItemData(timer_cb, idx, pts); } // add "new timer" item pts = (timeropt_t*)calloc(1, sizeof(timeropt_t)); memcpy(pts->name, "<Add New...>", 13); ComboBox_AddString(timer_cb, pts->name); ComboBox_SetItemData(timer_cb, count, pts); ComboBox_SetCurSel(timer_cb, 0); OnTimerName(hDlg); SendDlgItemMessage(hDlg, IDC_TIMERTEST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconPlay); SendDlgItemMessage(hDlg, IDC_TIMERDEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconDel); api.PositionWindow(hDlg,21); }
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); }
/** * This functions fills a combobox given by @hCtrl with * all items of the global timezone manager * * @param hDlg - HWND of the owning propertysheet page * @param idCtrl - the ID of the control to associate with this class's instance * @param pszSetting - the database setting to be handled by this class * * @return CTzCombo* **/ CBaseCtrl* CTzCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting) { CTzCombo *ctrl = NULL; HWND hCtrl = GetDlgItem(hDlg, idCtrl); ctrl = new CTzCombo(hDlg, idCtrl, pszSetting); if (ctrl) { //use new core tz interface if (tmi.prepareList) { //set the adress of our timezone handle as itemdata //caller can obtain the handle htz to extract all relevant information ctrl->_curSel = 0; tmi.prepareList(NULL, hCtrl, TZF_PLF_CB); } //fallback use old UIEX method else { ctrl->_curSel = ComboBox_AddString(hCtrl, TranslateT("<Unspecified>")); if (SUCCEEDED(ctrl->_curSel)) { ComboBox_SetItemData(hCtrl, ctrl->_curSel, NULL); } ComboBox_SetCurSel(hCtrl, ctrl->_curSel); EnumTimeZones(EnumNamesProc, (LPARAM)hCtrl); } } return (ctrl); }
/// <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 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 - 自定义 }
static void ComboBox_InitPageSize (HWND hwnd, LONG Page_size) { int i, index; typedef struct tagCxU { char* cx; LONG ux; } CxU; CxU pageSize [] = { {" 2K", 2048L}, {" 4K", 4096L}, {" 8K", 8192L}, {"16K",16384L}, {"32K",32768L}, {"64K",65536L} }; HWND hwndCombo = GetDlgItem (hwnd, IDC_COMBOPAGESIZE); for (i=0; i<6; i++) { index = ComboBox_AddString (hwndCombo, pageSize [i].cx); if (index != -1) ComboBox_SetItemData (hwndCombo, index, pageSize [i].ux); } ComboBox_SetCurSel(hwndCombo, 0); for (i=0; i<6; i++) { if (pageSize [i].ux == Page_size) { ComboBox_SetCurSel(hwndCombo, i); break; } } }
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); } } } } }
static BOOL OccupyStructureControl (HWND hwnd) /* Function: Fills the structure drop down box with the structure names. Parameters: hwnd - Handle to the dialog window. Returns: TRUE if successful. */ { int i = 0; BOOL bRetVal = TRUE; HWND hwndCtl = GetDlgItem (hwnd, IDC_STRUCTURE); HLOCAL hmem; LPSTRUCTINFO lpinfo; if (!IsWindow(hwndCtl)) { ASSERT(FALSE); return FALSE; } hmem = GetProp(hwnd, SZINFODEF); lpinfo = LocalLock(hmem); while (lpinfo[i].nStructName != -1) { char szStructName[50]; int nIdx; if (LoadString(hResource, lpinfo[i].nStructName, szStructName, sizeof(szStructName)) == 0) bRetVal = FALSE; nIdx = ComboBox_AddString(hwndCtl, szStructName); if (nIdx == CB_ERR) bRetVal = FALSE; else ComboBox_SetItemData(hwndCtl, nIdx, (LPARAM)i); if (GetOIVers() >= OIVERS_20) lpinfo[i].nIngresVersion = GetOIVers(); i++; } // Set the first string in the list as the default if (bRetVal) ComboBox_SetCurSel(hwndCtl, 0); LocalUnlock(hmem); return bRetVal; }
/// <summary> /// Load selected image and do some validation /// </summary> DWORD MainDlg::SetActiveProcess( bool createNew, const wchar_t* path, DWORD pid /*= 0xFFFFFFFF*/ ) { HWND hCombo = GetDlgItem( _hMainDlg, IDC_COMBO_PROC ); if (createNew) { std::wstring procName = blackbone::Utils::StripPath( path ) + L" (New process)"; // Update process list auto idx = ComboBox_AddString( hCombo, procName.c_str() ); ComboBox_SetItemData( hCombo, idx, -1 ); ComboBox_SetCurSel( hCombo, idx ); // Enable command line options field EnableWindow( GetDlgItem( _hMainDlg, IDC_CMDLINE ), TRUE ); _newProcess = true; _procPath = path; } else if (pid != 0xFFFFFFFF && AttachToProcess( pid ) == ERROR_SUCCESS) { FillThreads(); _newProcess = false; if (path != nullptr) { std::wstring procName = std::wstring( path ) + L" (" + std::to_wstring( _proc.pid() ) + L")"; _procPath = path; auto idx = ComboBox_AddString( hCombo, procName.c_str() ); ComboBox_SetItemData( hCombo, idx, -1 ); ComboBox_SetCurSel( hCombo, idx ); } else _procPath = _proc.modules().GetMainModule()->name; // Disable command line option field EnableWindow( GetDlgItem( _hMainDlg, IDC_CMDLINE ), FALSE ); } return ERROR_SUCCESS; }
static BOOL WINAPI DirectDrawEnumCallbackEx( GUID FAR* pGUID, LPSTR strDesc, LPSTR strName, VOID* pV, HMONITOR hMonitor ) { // Use the GUID to create the DirectDraw object, so that information // can be extracted from it. LPDIRECTDRAW pDD; LPDIRECTDRAW4 g_pDD; LPDIRECT3D3 pD3D; HRESULT (WINAPI *pDDrawCreateFn)(GUID *,LPDIRECTDRAW *,IUnknown *); pDDrawCreateFn = (LPVOID)GetProcAddress( hDDrawDLL, "DirectDrawCreate" ); if( pDDrawCreateFn == NULL || FAILED( pDDrawCreateFn( pGUID, &pDD, 0L ) ) ) { return D3DENUMRET_OK; } // Query the DirectDraw driver for access to Direct3D. if( FAILED(IDirectDraw_QueryInterface(pDD, &IID_IDirectDraw4, (VOID**)&g_pDD))) { IDirectDraw_Release(pDD); return D3DENUMRET_OK; } IDirectDraw_Release(pDD); // Query the DirectDraw driver for access to Direct3D. if( FAILED( IDirectDraw4_QueryInterface(g_pDD,&IID_IDirect3D3, (VOID**)&pD3D))) { IDirectDraw4_Release(g_pDD); return D3DENUMRET_OK; } bDeviceOK=FALSE; // Now, enumerate all the 3D devices IDirect3D3_EnumDevices(pD3D,Enum3DDevicesCallback,NULL); if(bDeviceOK) { HWND hWC=GetDlgItem(gHWND,IDC_DEVICE); int i=ComboBox_AddString(hWC,strDesc); GUID * g=(GUID *)malloc(sizeof(GUID)); if(NULL != pGUID) *g=*pGUID; else memset(g,0,sizeof(GUID)); ComboBox_SetItemData(hWC,i,g); } IDirect3D3_Release(pD3D); IDirectDraw4_Release(g_pDD); return DDENUMRET_OK; }
static BOOL OccupyPageSizeControl (HWND hwnd) /* Function: Ingres version == 1.x : Hide combobox and static name. Ingres version == 2.x : Fills the Page_size drop down box with the page size. Parameters: hwnd - Handle to the dialog window. Returns: TRUE if successful. */ { BOOL bRetVal = TRUE; DWORD dwi; int nIdx; char szpagesize[20]; HWND hwndCtl = GetDlgItem (hwnd, IDC_PAGESIZE); int ishowstate = GetOIVers() >= OIVERS_26 ? SW_SHOW : SW_HIDE; ShowWindow(GetDlgItem(hwnd,IDC_FRAME_PAGEORINDEX),ishowstate); ShowWindow(GetDlgItem(hwnd,IDC_TYPE_TABLE),ishowstate); ShowWindow(GetDlgItem(hwnd,IDC_TYPE_INDEX),ishowstate); if (GetOIVers() >= OIVERS_20) { ShowWindow(GetDlgItem(hwnd,IDC_STATIC_PAGESIZE),SW_SHOW); ShowWindow(GetDlgItem(hwnd,IDC_PAGESIZE),SW_SHOW); for (dwi=2048;dwi<65537;dwi=dwi*2) { wsprintf(szpagesize,"%5ld",dwi); nIdx = ComboBox_AddString(hwndCtl,szpagesize ); if (nIdx == CB_ERR) { bRetVal = FALSE; break; } else ComboBox_SetItemData(hwndCtl, nIdx, dwi); } // Set the first string in the list as the default if (bRetVal) ComboBox_SetCurSel(hwndCtl, 0); } else { ShowWindow(GetDlgItem(hwnd,IDC_STATIC_PAGESIZE),SW_HIDE); ShowWindow(GetDlgItem(hwnd,IDC_PAGESIZE),SW_HIDE); } return bRetVal; }
void CFixApp::PopulateDialog() { //Populate the GUI scale combobox for (size_t i = 1; i < 6; i++) { wchar_t szBuf[3]; swprintf_s(szBuf, L"x%Iu", i); ComboBox_AddString(m_hWndCBGUIScales, szBuf); } ComboBox_SetCurSel(m_hWndCBGUIScales, 0); //Populate the resolution combobox DEVMODE dm = {}; dm.dmSize = sizeof(dm); Resolution r= {}; for(DWORD iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != FALSE; iModeNum++) { if((dm.dmPelsWidth != r.iX || dm.dmPelsHeight != r.iY) && dm.dmBitsPerPel == 32) //Only add each res once, but don't actually check if it matches the current color depth/refresh rate { r.iX = dm.dmPelsWidth; r.iY = dm.dmPelsHeight; m_Resolutions.push_back(r); wchar_t szBuffer[20]; _snwprintf_s(szBuffer, _TRUNCATE, L"%Iux%Iu", r.iX, r.iY); int iIndex = ComboBox_AddString(m_hWndCBResolutions, szBuffer); ComboBox_SetItemData(m_hWndCBResolutions, iIndex, &(m_Resolutions.back())); } } ComboBox_SetCurSel(m_hWndCBResolutions, 0); //Renderers (based on UnEngineWin.h), requires appInit() to have been called TArray<FRegistryObjectInfo> Classes; Classes.Empty(); UObject::GetRegistryObjects( Classes, UClass::StaticClass(), URenderDevice::StaticClass(), 0 ); for( TArray<FRegistryObjectInfo>::TIterator It(Classes); It; ++It ) { FString Path = It->Object, Left, Right; if( Path.Split(L".",&Left,&Right) ) { const wchar_t* pszDesc = Localize(*Right,L"ClassCaption",*Left); assert(pszDesc); if(ComboBox_FindStringExact(m_hWndCBRenderers, -1, pszDesc) == CB_ERR) { ComboBox_AddString(m_hWndCBRenderers, pszDesc); m_Renderers.emplace_back(static_cast<wchar_t*>(Path.GetCharArray().GetData())); } } } }
/* ** Called when tab is displayed. ** */ void CDialogManage::CTabSettings::Initialize() { m_Initialized = true; // Scan for languages HWND item = GetDlgItem(m_Window, IDC_MANAGESETTINGS_LANGUAGE_COMBOBOX); std::wstring files = Rainmeter->GetPath() + L"Languages\\*.dll"; WIN32_FIND_DATA fd; HANDLE hSearch = FindFirstFile(files.c_str(), &fd); if (hSearch != INVALID_HANDLE_VALUE) { do { WCHAR* pos = wcschr(fd.cFileName, L'.'); if (pos) { LCID lcid = (LCID)wcstoul(fd.cFileName, &pos, 10); if (pos != fd.cFileName && _wcsicmp(pos, L".dll") == 0 && GetLocaleInfo(lcid, LOCALE_SENGLISHLANGUAGENAME, fd.cFileName, MAX_PATH) > 0) { // Strip brackets in language name std::wstring text = fd.cFileName; text += L" - "; GetLocaleInfo(lcid, LOCALE_SNATIVELANGUAGENAME, fd.cFileName, MAX_PATH); text += fd.cFileName; int index = ComboBox_AddString(item, text.c_str()); ComboBox_SetItemData(item, index, (LPARAM)lcid); if (lcid == Rainmeter->GetResourceLCID()) { ComboBox_SetCurSel(item, index); } } } } while (FindNextFile(hSearch, &fd)); FindClose(hSearch); } Button_SetCheck(GetDlgItem(m_Window, IDC_MANAGESETTINGS_CHECKUPDATES_CHECKBOX), !Rainmeter->GetDisableVersionCheck()); Button_SetCheck(GetDlgItem(m_Window, IDC_MANAGESETTINGS_LOCKSKINS_CHECKBOX), Rainmeter->GetDisableDragging()); Button_SetCheck(GetDlgItem(m_Window, IDC_MANAGESETTINGS_LOGTOFILE_CHECKBOX), Rainmeter->GetLogging()); Button_SetCheck(GetDlgItem(m_Window, IDC_MANAGESETTINGS_VERBOSELOGGING_CHECKBOX), Rainmeter->GetDebug()); BOOL isLogFile = (_waccess(Rainmeter->GetLogFile().c_str(), 0) != -1); EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON), isLogFile); EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON), isLogFile); }
/** * Adds a string and associated item data to a combobox. * * @param pszText - the text to add to the combobox * @param lParam - item data to accociate with the new item * * @return zero-based index to new item or CB_ERR on failure **/ INT_PTR CCombo::AddItem(LPCTSTR pszText, LPARAM lParam) { INT_PTR added = ComboBox_AddString(_hwnd, pszText); if (SUCCEEDED(added)) { if (PtrIsValid(lParam) && FAILED(ComboBox_SetItemData(_hwnd, added, lParam))) { ComboBox_DeleteString(_hwnd, added); added = CB_ERR; } } return added; }
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)); }
void GroupGeneralPage::dialogInit(HWND hWnd,LPARAM lParam) { m_hCheckAdmin = GetDlgItem(hWnd,IDC_CHECK_ADMIN); m_hCheckBrowser = GetDlgItem(hWnd,IDC_CHECK_BROWSER); m_hCheckBypassLimits = GetDlgItem(hWnd,IDC_CHECK_BYPASSLIMITS); m_hCheckMaxBandwidth = GetDlgItem(hWnd,IDC_CHECK_MAXBANDWIDTH); m_hCheckMaxDownload = GetDlgItem(hWnd,IDC_CHECK_MAXDOWNLOAD); m_hComboMaxDownloadPeriod = GetDlgItem(hWnd,IDC_COMBO_MAXDOWNLOADPERIOD); m_hCheckMaxSessions = GetDlgItem(hWnd,IDC_CHECK_MAXSESSIONS); m_hCheckMaxSessionsPerIp = GetDlgItem(hWnd,IDC_CHECK_MAXSESSIONSPERIP); m_hEditMaxBandwidth = GetDlgItem(hWnd,IDC_EDIT_MAXBANDWIDTH); m_hEditMaxDownload = GetDlgItem(hWnd,IDC_EDIT_MAXDOWNLOAD); m_hEditMaxSessions = GetDlgItem(hWnd,IDC_EDIT_MAXSESSIONS); m_hEditMaxSessionsPerIp = GetDlgItem(hWnd,IDC_EDIT_MAXSESSIONSPERIP); ComboBox_AddString(m_hComboMaxDownloadPeriod,"Day"); ComboBox_AddString(m_hComboMaxDownloadPeriod,"Week"); ComboBox_AddString(m_hComboMaxDownloadPeriod,"Month"); ComboBox_SetItemData(m_hComboMaxDownloadPeriod,0,(int)Group::DownloadPeriod::DAY); ComboBox_SetItemData(m_hComboMaxDownloadPeriod,1,(int)Group::DownloadPeriod::WEEK); ComboBox_SetItemData(m_hComboMaxDownloadPeriod,2,(int)Group::DownloadPeriod::MONTH); SetWindowPos(m_hCheckAdmin,NULL,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckBrowser,m_hCheckBrowser,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckBypassLimits,m_hCheckBrowser,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckMaxSessions,m_hCheckBypassLimits,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hEditMaxSessions,m_hCheckMaxSessions,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckMaxSessionsPerIp,m_hEditMaxSessions,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hEditMaxSessionsPerIp,m_hCheckMaxSessionsPerIp,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckMaxDownload,m_hEditMaxSessionsPerIp,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hEditMaxDownload,m_hCheckMaxDownload,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hComboMaxDownloadPeriod,m_hEditMaxDownload,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hCheckMaxBandwidth,m_hComboMaxDownloadPeriod,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(m_hEditMaxBandwidth,m_hCheckMaxBandwidth,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE); SetWindowPos(hWnd,HWND_TOP,166,5,-1,-1,SWP_NOSIZE); }
INT_PTR CALLBACK GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam) { LPPSHNOTIFY psn; langProcData langData = { .languages = GetDlgItem(hwndDlg, ID_CMB_LANGUAGE), .language = GetGUILanguage() }; switch(msg) { case WM_INITDIALOG: /* Populate UI language selection combo box */ EnumResourceLanguages( NULL, RT_STRING, MAKEINTRESOURCE(IDS_LANGUAGE_NAME / 16 + 1), (ENUMRESLANGPROC) FillLangListProc, (LONG_PTR) &langData ); /* If none of the available languages matched, select the fallback */ if (ComboBox_GetCurSel(langData.languages) == CB_ERR) ComboBox_SelectString(langData.languages, -1, LangListEntry(IDS_LANGUAGE_NAME, fallbackLangId)); /* Clear language id data for the selected item */ ComboBox_SetItemData(langData.languages, ComboBox_GetCurSel(langData.languages), 0); if (GetLaunchOnStartup()) Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP), BST_CHECKED); break; case WM_NOTIFY: psn = (LPPSHNOTIFY) lParam; if (psn->hdr.code == (UINT) PSN_APPLY) { LANGID langId = (LANGID) ComboBox_GetItemData(langData.languages, ComboBox_GetCurSel(langData.languages)); if (langId != 0) SetGUILanguage(langId); SetLaunchOnStartup(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP)) == BST_CHECKED); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); return TRUE; } break; } return FALSE; }
static INT_PTR EnumNamesProc(CTimeZone *pTimeZone, int index, LPARAM lParam) { if (pTimeZone && pTimeZone->ptszDisplay) { int added = ComboBox_AddString((HWND)lParam, pTimeZone->ptszDisplay); if (SUCCEEDED(added)) { if (FAILED(ComboBox_SetItemData((HWND)lParam, added, pTimeZone))) { ComboBox_DeleteString((HWND)lParam, added); } } } return 0; }
static BOOL FillLangListProc(UNUSED HANDLE module, UNUSED PTSTR type, UNUSED PTSTR stringId, WORD langId, LONG_PTR lParam) { langProcData *data = (langProcData*) lParam; int index = ComboBox_AddString(data->languages, LangListEntry(IDS_LANGUAGE_NAME, langId)); ComboBox_SetItemData(data->languages, index, langId); /* Select this item if it is the currently displayed language */ if (langId == data->language || (PRIMARYLANGID(langId) == PRIMARYLANGID(data->language) && ComboBox_GetCurSel(data->languages) == CB_ERR) ) ComboBox_SetCurSel(data->languages, index); return TRUE; }
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)); }
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); } } }