test: combodir.c File Reference

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

# combodir.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Defines

#define | CTLMGR
#define | LSTRING

## Functions

int | xxxCBDir (PCBOX pcbox, UINT attrib, LPWSTR pFileName)
int | DlgDirSelectComboBoxExA (HWND hwndDlg, LPSTR pszOut, int cchOut, int idComboBox)
int | DlgDirSelectComboBoxExW (HWND hwndDlg, LPWSTR pwszOut, int cchOut, int idComboBox)
int | DlgDirListComboBoxA (HWND hwndDlg, LPSTR lpszPathSpecClient, int idComboBox, int idStaticPath, UINT attrib)
int | DlgDirListComboBoxW (HWND hwndDlg, LPWSTR lpszPathSpecClient, int idComboBox, int idStaticPath, UINT attrib)

## Define Documentation

#define CTLMGR

| Definition at line 13 of file combodir.c.

#define LSTRING

| Definition at line 14 of file combodir.c.

## Function Documentation

int DlgDirListComboBoxA | ( | HWND | hwndDlg,
|  | LPSTR | lpszPathSpecClient,
|  | int | idComboBox,
|  | int | idStaticPath,
|  | UINT | attrib
| ) |

Definition at line 130 of file combodir.c.

References BOOL, FALSE, NULL, ThreadLock, ThreadUnlock, TRUE, UserLocalFree, ValidateHwnd, and xxxDlgDirListHelper().

    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 }

int DlgDirListComboBoxW | ( | HWND | hwndDlg,
|  | LPWSTR | lpszPathSpecClient,
|  | int | idComboBox,
|  | int | idStaticPath,
|  | UINT | attrib
| ) |

Definition at line 172 of file combodir.c.

References BOOL, FALSE, NULL, ThreadLock, ThreadUnlock, ValidateHwnd, and xxxDlgDirListHelper().

    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 }

int DlgDirSelectComboBoxExA | ( | HWND | hwndDlg,
|  | LPSTR | pszOut,
|  | int | cchOut,
|  | int | idComboBox
| ) |

Definition at line 70 of file combodir.c.

References BOOL, DlgDirSelectComboBoxExW(), FALSE, UserLocalAlloc, and UserLocalFree.

    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 }

int DlgDirSelectComboBoxExW | ( | HWND | hwndDlg,
|  | LPWSTR | pwszOut,
|  | int | cchOut,
|  | int | idComboBox
| ) |

Definition at line 93 of file combodir.c.

References _GetDlgItem(), DlgDirSelectHelper(), FALSE, HWq, NULL, tagCBox::spwndList, and ValidateHwnd.

Referenced by DlgDirSelectComboBoxExA().

    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 }

int xxxCBDir | ( | PCBOX | pcbox,
|  | UINT | attrib,
|  | LPWSTR | pFileName
| ) |

Definition at line 28 of file combodir.c.

References CheckLock, tagCBox::spwnd, tagLBIV::spwnd, tagCBox::spwndList, ThreadLock, ThreadUnlock, and xxxLbDir().

Referenced by ComboBoxWndProcWorker().

    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 }