============================================================================= DriveBox_SelectDrive
| 1275 | // DriveBox_SelectDrive |
| 1276 | // |
| 1277 | BOOL DriveBox_SelectDrive(HWND hwnd,LPCWSTR lpszPath) |
| 1278 | { |
| 1279 | |
| 1280 | COMBOBOXEXITEM cbei; |
| 1281 | LPDC_ITEMDATA lpdcid; |
| 1282 | WCHAR szRoot[64]; |
| 1283 | |
| 1284 | int i; |
| 1285 | int cbItems = (int)SendMessage(hwnd,CB_GETCOUNT,0,0); |
| 1286 | |
| 1287 | // No Drives in Combo Box |
| 1288 | if (!cbItems) |
| 1289 | return FALSE; |
| 1290 | |
| 1291 | cbei.mask = CBEIF_LPARAM; |
| 1292 | |
| 1293 | for (i = 0; i < cbItems; i++) |
| 1294 | { |
| 1295 | // Get DC_ITEMDATA* of Item i |
| 1296 | cbei.iItem = i; |
| 1297 | SendMessage(hwnd,CBEM_GETITEM,0,(LPARAM)&cbei); |
| 1298 | lpdcid = (LPDC_ITEMDATA)cbei.lParam; |
| 1299 | |
| 1300 | // Get File System Path for Drive |
| 1301 | IL_GetDisplayName(lpdcid->lpsf,lpdcid->pidl,SHGDN_FORPARSING,szRoot,64); |
| 1302 | |
| 1303 | // Compare Root Directory with Path |
| 1304 | if (PathIsSameRoot(lpszPath,szRoot)) |
| 1305 | { |
| 1306 | // Select matching Drive |
| 1307 | SendMessage(hwnd,CB_SETCURSEL,i,0); |
| 1308 | return TRUE; |
| 1309 | } |
| 1310 | } |
| 1311 | |
| 1312 | // Don't select anything |
| 1313 | SendMessage(hwnd,CB_SETCURSEL,(WPARAM)-1,0); |
| 1314 | return FALSE; |
| 1315 | |
| 1316 | } |
| 1317 | |
| 1318 | |
| 1319 | //============================================================================= |
nothing calls this directly
no test coverage detected