Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

combodir.c

Go to the documentation of this file.
00001 /**************************** Module Header ********************************\ 00002 * Module Name: combodir.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * Directory Combo Box Routines 00007 * 00008 * History: 00009 * ??-???-???? ?????? Ported from Win 3.0 sources 00010 * 01-Feb-1991 mikeke Added Revalidation code 00011 \***************************************************************************/ 00012 00013 #define CTLMGR 00014 #define LSTRING 00015 00016 #include "precomp.h" 00017 #pragma hdrstop 00018 00019 /***************************************************************************\ 00020 * xxxCBDir 00021 * 00022 * Supports the CB_DIR message which adds a list of files from the 00023 * current directory to the combo box. 00024 * 00025 * History: 00026 \***************************************************************************/ 00027 00028 int xxxCBDir( 00029 PCBOX pcbox, 00030 UINT attrib, 00031 LPWSTR pFileName) 00032 { 00033 PLBIV plb; 00034 int errorValue; 00035 TL tlpwnd; 00036 00037 CheckLock(pcbox->spwnd); 00038 UserAssert(pcbox->spwndList); 00039 00040 plb = ((PLBWND)pcbox->spwndList)->pLBIV; 00041 00042 ThreadLock(plb->spwnd, &tlpwnd); 00043 errorValue = xxxLbDir(plb, attrib, pFileName); 00044 ThreadUnlock(&tlpwnd); 00045 00046 switch (errorValue) { 00047 case LB_ERR: 00048 return CB_ERR; 00049 break; 00050 case LB_ERRSPACE: 00051 return CB_ERRSPACE; 00052 break; 00053 default: 00054 return errorValue; 00055 break; 00056 } 00057 } 00058 00059 /***************************************************************************\ 00060 * DlgDirSelectComboBoxEx 00061 * 00062 * Retrieves the current selection from the listbox of a combobox. 00063 * It assumes that the combo box was filled by xxxDlgDirListComboBox() 00064 * and that the selection is a drive letter, a file, or a directory name. 00065 * 00066 * History: 00067 * 12-05-90 IanJa converted to internal version 00068 \***************************************************************************/ 00069 00070 int DlgDirSelectComboBoxExA( 00071 HWND hwndDlg, 00072 LPSTR pszOut, 00073 int cchOut, 00074 int idComboBox) 00075 { 00076 LPWSTR lpwsz; 00077 BOOL fRet; 00078 00079 lpwsz = (LPWSTR)UserLocalAlloc(HEAP_ZERO_MEMORY, cchOut * sizeof(WCHAR)); 00080 if (!lpwsz) { 00081 return FALSE; 00082 } 00083 00084 fRet = DlgDirSelectComboBoxExW(hwndDlg, lpwsz, cchOut, idComboBox); 00085 00086 WCSToMB(lpwsz, -1, &pszOut, cchOut, FALSE); 00087 00088 UserLocalFree(lpwsz); 00089 00090 return fRet; 00091 } 00092 00093 int DlgDirSelectComboBoxExW( 00094 HWND hwndDlg, 00095 LPWSTR pwszOut, 00096 int cchOut, 00097 int idComboBox) 00098 { 00099 PWND pwndDlg; 00100 PWND pwndComboBox; 00101 PCBOX pcbox; 00102 00103 pwndDlg = ValidateHwnd(hwndDlg); 00104 00105 if (pwndDlg == NULL) 00106 return FALSE; 00107 00108 pwndComboBox = _GetDlgItem(pwndDlg, idComboBox); 00109 if (pwndComboBox == NULL) { 00110 RIPERR0(ERROR_CONTROL_ID_NOT_FOUND, RIP_VERBOSE, ""); 00111 return 0; 00112 } 00113 pcbox = ((PCOMBOWND)pwndComboBox)->pcbox; 00114 if (pcbox == NULL) { 00115 RIPERR0(ERROR_WINDOW_NOT_COMBOBOX, RIP_VERBOSE, ""); 00116 return 0; 00117 } 00118 00119 return DlgDirSelectHelper(pwszOut, cchOut, HWq(pcbox->spwndList)); 00120 } 00121 00122 00123 /***************************************************************************\ 00124 * xxxDlgDirListComboBox 00125 * 00126 * History: 00127 * 12-05-90 IanJa converted to internal version 00128 \***************************************************************************/ 00129 00130 int DlgDirListComboBoxA( 00131 HWND hwndDlg, 00132 LPSTR lpszPathSpecClient, 00133 int idComboBox, 00134 int idStaticPath, 00135 UINT attrib) 00136 { 00137 LPWSTR lpszPathSpec; 00138 TL tlpwndDlg; 00139 PWND pwndDlg; 00140 BOOL fRet; 00141 00142 pwndDlg = ValidateHwnd(hwndDlg); 00143 00144 if (pwndDlg == NULL) 00145 return FALSE; 00146 00147 lpszPathSpec = NULL; 00148 if (lpszPathSpecClient) { 00149 if (!MBToWCS(lpszPathSpecClient, -1, &lpszPathSpec, -1, TRUE)) 00150 return FALSE; 00151 } 00152 00153 ThreadLock(pwndDlg, &tlpwndDlg); 00154 fRet = xxxDlgDirListHelper(pwndDlg, lpszPathSpec, lpszPathSpecClient, 00155 idComboBox, idStaticPath, attrib, FALSE); 00156 ThreadUnlock(&tlpwndDlg); 00157 00158 if (lpszPathSpec) { 00159 if (fRet) { 00160 /* 00161 * Non-zero retval means some text to copy out. Copy out up to 00162 * the nul terminator (buffer will be big enough). 00163 */ 00164 WCSToMB(lpszPathSpec, -1, &lpszPathSpecClient, MAXLONG, FALSE); 00165 } 00166 UserLocalFree(lpszPathSpec); 00167 } 00168 00169 return fRet; 00170 } 00171 00172 int DlgDirListComboBoxW( 00173 HWND hwndDlg, 00174 LPWSTR lpszPathSpecClient, 00175 int idComboBox, 00176 int idStaticPath, 00177 UINT attrib) 00178 { 00179 LPWSTR lpszPathSpec; 00180 PWND pwndDlg; 00181 TL tlpwndDlg; 00182 BOOL fRet; 00183 00184 pwndDlg = ValidateHwnd(hwndDlg); 00185 00186 if (pwndDlg == NULL) 00187 return FALSE; 00188 00189 lpszPathSpec = lpszPathSpecClient; 00190 00191 ThreadLock(pwndDlg, &tlpwndDlg); 00192 fRet = xxxDlgDirListHelper(pwndDlg, lpszPathSpec, (LPBYTE)lpszPathSpecClient, 00193 idComboBox, idStaticPath, attrib, FALSE); 00194 ThreadUnlock(&tlpwndDlg); 00195 00196 return fRet; 00197 }

Generated on Sat May 15 19:39:30 2004 for test by doxygen 1.3.7