| 1080 | // |
| 1081 | |
| 1082 | int DriveBox_Fill(HWND hwnd) |
| 1083 | { |
| 1084 | |
| 1085 | LPSHELLFOLDER lpsfDesktop; |
| 1086 | LPSHELLFOLDER lpsf; // Workspace == CSIDL_DRIVES |
| 1087 | |
| 1088 | LPITEMIDLIST pidl; |
| 1089 | LPITEMIDLIST pidlEntry; |
| 1090 | |
| 1091 | LPENUMIDLIST lpe; |
| 1092 | |
| 1093 | COMBOBOXEXITEM cbei; |
| 1094 | LPDC_ITEMDATA lpdcid; |
| 1095 | |
| 1096 | ULONG dwAttributes = 0; |
| 1097 | |
| 1098 | DWORD grfFlags = SHCONTF_FOLDERS; |
| 1099 | |
| 1100 | |
| 1101 | // Init ComboBox |
| 1102 | SendMessage(hwnd,WM_SETREDRAW,0,0); |
| 1103 | SendMessage(hwnd,CB_RESETCONTENT,0,0); |
| 1104 | |
| 1105 | ZeroMemory(&cbei,sizeof(COMBOBOXEXITEM)); |
| 1106 | cbei.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_LPARAM; |
| 1107 | cbei.pszText = LPSTR_TEXTCALLBACK; |
| 1108 | cbei.cchTextMax = MAX_PATH; |
| 1109 | cbei.iImage = I_IMAGECALLBACK; |
| 1110 | cbei.iSelectedImage = I_IMAGECALLBACK; |
| 1111 | |
| 1112 | |
| 1113 | // Get pidl to [My Computer] |
| 1114 | if (NOERROR == SHGetSpecialFolderLocation(hwnd, |
| 1115 | CSIDL_DRIVES, |
| 1116 | &pidl)) |
| 1117 | { |
| 1118 | |
| 1119 | // Get Desktop Folder |
| 1120 | if (NOERROR == SHGetDesktopFolder(&lpsfDesktop)) |
| 1121 | { |
| 1122 | |
| 1123 | // Bind pidl to IShellFolder |
| 1124 | if (NOERROR == lpsfDesktop->lpVtbl->BindToObject( |
| 1125 | lpsfDesktop, |
| 1126 | pidl, |
| 1127 | NULL, |
| 1128 | &IID_IShellFolder, |
| 1129 | &lpsf)) |
| 1130 | |
| 1131 | { |
| 1132 | |
| 1133 | // Create an Enumeration object for lpsf |
| 1134 | if (NOERROR == lpsf->lpVtbl->EnumObjects( |
| 1135 | lpsf, |
| 1136 | hwnd, |
| 1137 | grfFlags, |
| 1138 | &lpe)) |
| 1139 | |