void OpenCell_OnInitDialog (HWND hDlg, LPOPENCELLDLG_PARAMS lpp) { // Fix the title of the dialog (unless the caller has supplied a // custom dialog template) // if (lpp && (lpp->idd == IDD_APPLIB_OPENCELL)) { TCHAR szApplication[ cchNAME ]; AfsAppLib_GetAppName (szApplication); if (szApplication[0] != TEXT('\0')) { TCHAR szTitle[ cchRESOURCE ]; GetWindowText (hDlg, szTitle, cchRESOURCE); lstrcat (szTitle, TEXT(" - ")); lstrcat (szTitle, szApplication); SetWindowText (hDlg, szTitle); } } // Fill in the 'Cell:' combobox; we'll list the default cell, and any // cell which the user has specified before. // CB_StartChange (GetDlgItem (hDlg, IDC_OPENCELL_CELL), TRUE); if (!lpp->lpcl) { TCHAR szDefCell[ cchNAME ]; if (AfsAppLib_GetLocalCell (szDefCell) && *szDefCell) { CB_AddItem (GetDlgItem (hDlg, IDC_OPENCELL_CELL), szDefCell, 1); } } else for (size_t ii = 0; ii < lpp->lpcl->nCells; ++ii) { CB_AddItem (GetDlgItem (hDlg, IDC_OPENCELL_CELL), lpp->lpcl->aCells[ii], 1+ii); } CB_EndChange (GetDlgItem (hDlg, IDC_OPENCELL_CELL), 1); // Set up the "Credentials" box; if the user needs credentials to edit // this default cell, jump the cursor to the appropriate field // SetDlgItemText (hDlg, IDC_OPENCELL_ID, TEXT("admin")); OpenCell_OnCell (hDlg); }
static void SetUpYesNoCombo(HWND hDlg, UINT nCtrlID, BOOL fInitialSetting) { static TCHAR szYes[10] = TEXT(""); static TCHAR szNo[10] = TEXT(""); if (!*szYes) { GetString (szYes, IDS_YES); GetString (szNo, IDS_NO); } HWND hCombo = GetDlgItem(hDlg, nCtrlID); // Always add szNo first so it has index 0 and szYes has index 1 CB_AddItem (hCombo, szNo, 0); CB_AddItem (hCombo, szYes, 0); CB_SetSelected (hCombo, fInitialSetting); }
void Filesets_Create_OnInitDialog (HWND hDlg, LPSET_CREATE_PARAMS pscp) { HWND hList = GetDlgItem (hDlg, IDC_AGG_LIST); if (procFilesetsCreateList == 0) procFilesetsCreateList = GetWindowLongPtr (hList, GWLP_WNDPROC); SetWindowLongPtr (hList, GWLP_WNDPROC, (LONG_PTR)Filesets_Create_SubclassListProc); if (gr.viewAggCreate.lvsView == 0) // never initialized this? { if (gr.viewAggMove.lvsView == 0) memcpy (&gr.viewAggCreate, &gr.viewAgg, sizeof(VIEWINFO)); else memcpy (&gr.viewAggCreate, &gr.viewAggMove, sizeof(VIEWINFO)); } FL_RestoreView (GetDlgItem (hDlg, IDC_AGG_LIST), &gr.viewAggCreate); SetDlgItemText (hDlg, IDC_SET_NAME, pscp->szName); CB_StartChange (GetDlgItem (hDlg, IDC_SET_QUOTA_UNITS), TRUE); CB_AddItem (GetDlgItem (hDlg, IDC_SET_QUOTA_UNITS), IDS_QUOTAUNITS_KB, (LPARAM)cb1KB); CB_AddItem (GetDlgItem (hDlg, IDC_SET_QUOTA_UNITS), IDS_QUOTAUNITS_MB, (LPARAM)cb1MB); CB_EndChange (GetDlgItem (hDlg, IDC_SET_QUOTA_UNITS), (LPARAM)gr.cbQuotaUnits); CheckDlgButton (hDlg, IDC_SET_CLONE, pscp->fCreateClone); // Create a spinner, and give it an appropriate min/max range. We'll // have to *find* that range in a separate thread, 'cause it involves // getting the status of an aggregate. // StartTask (taskAGG_FIND_QUOTA_LIMITS, hDlg, pscp->lpiParent); // Fill in the Servers combobox, and select the default server // (if one was specified). // LPSVR_ENUM_TO_COMBOBOX_PACKET lpp = New (SVR_ENUM_TO_COMBOBOX_PACKET); lpp->hCombo = GetDlgItem (hDlg, IDC_SET_SERVER); lpp->lpiSelect = (pscp->lpiParent) ? pscp->lpiParent->GetServer() : NULL; StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lpp); EnableWindow (GetDlgItem (hDlg, IDC_SET_SERVER), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_AGG_LIST), FALSE); EnableWindow (GetDlgItem (hDlg, IDOK), FALSE); }
void Help_FindCommand_OnInitDialog (HWND hDlg) { HWND hCombo = GetDlgItem (hDlg, IDC_FIND_COMMAND); CB_StartChange (hCombo, TRUE); for (size_t ii = 0; ii < nCOMMANDS; ++ii) { CB_AddItem (hCombo, aCOMMANDS[ii].ids, 0); } CB_EndChange (hCombo, -1); }
void Columns_OnInitDialog (HWND hDlg, LPVIEWINFO lpviDefault) { HWND hList = GetDlgItem (hDlg, IDC_COLUMNS); CB_StartChange (hList); for (size_t iCol = 0; iCol < nCOLUMNS; ++iCol) { if ((COLUMNS[iCol].fUsuallyHidden) && (lpviDefault != &COLUMNS[iCol].vi)) continue; CB_AddItem (hList, COLUMNS[iCol].ids, (LPARAM)&COLUMNS[iCol].vi); } CB_EndChange (hList, (LPARAM)lpviDefault); Columns_OnSelect (hDlg); }
void DlgProc_Browse_OnInitDialog (HWND hDlg, BROWSEDIALOGPARAMS *pbdp) { TCHAR szText[ cchRESOURCE ]; LPTSTR psz; pbdp->hDlg = hDlg; // We'll need an imagelist, if we want icons in the listview. // This looks difficult but it's not--tis just a matter of selecting // an appropriate bitmap. // if ((pbdp->hImages = ImageList_Create (cxICON, cyICON, ILC_COLOR4 | ILC_MASK, 1, 1)) != 0) { HBITMAP bmp; if (pbdp->bt == btLOCAL_USER) { bmp = LoadBitmap (APPLIB_HINST, MAKEINTRESOURCE( IDB_LOCAL_USER )); } else if (pbdp->bt == btANY_USER) { bmp = LoadBitmap (APPLIB_HINST, MAKEINTRESOURCE( IDB_FOREIGN_USER )); } else if (pbdp->bt == btLOCAL_GROUP) { bmp = LoadBitmap (APPLIB_HINST, MAKEINTRESOURCE( IDB_LOCAL_GROUP )); } else if (pbdp->bt == btANY_GROUP) { bmp = LoadBitmap (APPLIB_HINST, MAKEINTRESOURCE( IDB_FOREIGN_GROUP )); } if (bmp != NULL) { ImageList_AddMasked (pbdp->hImages, bmp, clrTRANSPARENT); DeleteObject (bmp); } ListView_SetImageList (GetDlgItem (hDlg, IDC_BROWSE_LIST), pbdp->hImages, LVSIL_SMALL); } // There's a default pushbutton on this dialog, so that hitting // RETURN when you're in the Cell combobox will restart the search // (a default pushbutton always gets called when RETURN is hit, // unless your control traps it). But the user doesn't want to *see* // that thing, so move it way off the dialog's client area. // RECT r; GetWindowRect (GetDlgItem (hDlg, IDC_BROWSE_RESTART), &r); SetWindowPos (GetDlgItem (hDlg, IDC_BROWSE_RESTART), NULL, 0 - (r.right-r.left), 0 - (r.bottom-r.top), 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); // Fill in the choices underneath IDC_BROWSE_CELL. Can the // user enter a new cell name? // if (pbdp->fThisCellOnly) { EnableWindow (GetDlgItem (hDlg, IDC_BROWSE_CELL), FALSE); } else { CB_StartChange (GetDlgItem (hDlg, IDC_BROWSE_CELL)); if (!pbdp->lpcl) { TCHAR szDefCell[ cchNAME ]; if (AfsAppLib_GetLocalCell (szDefCell) && *szDefCell) { CB_AddItem (GetDlgItem (hDlg, IDC_BROWSE_CELL), szDefCell, 1); } } else for (size_t ii = 0; ii < pbdp->lpcl->nCells; ++ii) { CB_AddItem (GetDlgItem (hDlg, IDC_BROWSE_CELL), pbdp->lpcl->aCells[ii], 1+ii); } CB_EndChange (GetDlgItem (hDlg, IDC_BROWSE_CELL), 1); } // Select various texts to display in the dialog // psz = FormatString (TEXT("%1"), TEXT("%m"), pbdp->idsTitle); SetWindowText (hDlg, psz); FreeString (psz); GetString (szText, pbdp->idsPrompt); SetDlgItemText (hDlg, IDC_BROWSE_TYPE, szText); // If the caller wants us to display a "[X] No Group" checkbox, do so // by creating a checkbox right underneath the IDC_BROWSE_NAMED edit // control--note that we'll have to hide IDC_BROWSE_STATUS if that's // the case. // if (pbdp->idsNone != 0) { ShowWindow (GetDlgItem (pbdp->hDlg, IDC_BROWSE_STATUS), FALSE); RECT rr; GetRectInParent (GetDlgItem (pbdp->hDlg, IDC_BROWSE_NAMED), &rr); LONG cy; cy = rr.bottom -rr.top; rr.top += cy +3; rr.bottom = rr.top +cy; GetString (szText, pbdp->idsNone); CreateWindow ("Button", szText, WS_CHILD | BS_AUTOCHECKBOX, rr.left, rr.top, rr.right-rr.left, rr.bottom-rr.top, pbdp->hDlg, (HMENU)IDC_BROWSE_NONE, APPLIB_HINST, 0); HFONT hf = (HFONT)GetStockObject (DEFAULT_GUI_FONT); SendMessage (GetDlgItem (pbdp->hDlg, IDC_BROWSE_NONE), WM_SETFONT, (WPARAM)hf, FALSE); ShowWindow (GetDlgItem (pbdp->hDlg, IDC_BROWSE_NONE), TRUE); if (pbdp->szNamed[0] == TEXT('\0')) CheckDlgButton (pbdp->hDlg, IDC_BROWSE_NONE, TRUE); else CheckDlgButton (pbdp->hDlg, IDC_BROWSE_NONE, FALSE); DlgProc_Browse_OnNone (pbdp->hDlg, pbdp); } SetDlgItemText (hDlg, IDC_BROWSE_CELL, pbdp->szCell); SetDlgItemText (hDlg, IDC_BROWSE_NAMED, pbdp->szNamed); // Start looking for users/groups // DlgProc_Browse_StartSearch (pbdp, TRUE); }
void Browse_OnInitDialog (HWND hDlg) { LPBROWSE_PARAMS lpp; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { // First, the text of the dialog is woefully ugly right now. Put // in the strings which the caller supplied. // TCHAR szText[ cchRESOURCE ]; GetString (szText, lpp->idsTitle); SetWindowText (hDlg, szText); GetString (szText, lpp->idsPrompt); SetDlgItemText (hDlg, IDC_BROWSE_TYPE, szText); SetDlgItemText (hDlg, IDC_BROWSE_NAMED, lpp->szName); SetDlgItemText (hDlg, IDC_BROWSE_PATTERN, TEXT("")); ULONG status; asc_CellNameGet_Fast (g.idClient, g.idCell, szText, &status); SetDlgItemText (hDlg, IDC_BROWSE_CELL, szText); EnableWindow (GetDlgItem (hDlg, IDC_BROWSE_CELL), FALSE); if (GetDlgItem (hDlg, IDC_BROWSE_CHECK)) { if (lpp->idsCheck == 0) ShowWindow (GetDlgItem (hDlg, IDC_BROWSE_CHECK), FALSE); else { GetString (szText, lpp->idsCheck); SetDlgItemText (hDlg, IDC_BROWSE_CHECK, szText); } CheckDlgButton (hDlg, IDC_BROWSE_CHECK, (lpp->pObjectsToSkip) ? TRUE : FALSE); } if (GetDlgItem (hDlg, IDC_BROWSE_COMBO)) { HWND hCombo = GetDlgItem (hDlg, IDC_BROWSE_COMBO); LPARAM lpSelect = 0; CB_StartChange (hCombo, TRUE); if (lpp->TypeToShow & TYPE_USER) { CB_AddItem (hCombo, IDS_SHOW_USERS, TYPE_USER); if (!lpSelect) lpSelect = TYPE_USER; } if (lpp->TypeToShow & TYPE_GROUP) { CB_AddItem (hCombo, IDS_SHOW_GROUPS, TYPE_GROUP); if (!lpSelect) lpSelect = TYPE_GROUP; } CB_EndChange (hCombo, lpSelect); } // If the caller requested that we disallow multiple selection, // change the fastlist's styles... // if (!lpp->fAllowMultiple) { DWORD dwStyle = GetWindowLong (GetDlgItem (hDlg, IDC_BROWSE_LIST), GWL_STYLE); dwStyle &= ~(FLS_SELECTION_MULTIPLE); SetWindowLong (GetDlgItem (hDlg, IDC_BROWSE_LIST), GWL_STYLE, dwStyle); } // Finally, update the listbox to show a valid list of users/groups. // Oh--since we're in initdialog, add an imagelist to the window too. // FastList_SetImageLists (GetDlgItem (hDlg, IDC_BROWSE_LIST), AfsAppLib_CreateImageList(FALSE), NULL); Browse_UpdateDialog (hDlg); } }