Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
For an installation application, I needed a control to have the user choose the target installation drive. Since the application is targeted for Windows 95/98/NT, I thought it would be nice to use at least the same names as the Windows Explorer. When I found out where to get them (SHGetFileInfo) I saw that this function would also return the respective icons. Why not use both in that control? This was when I looked at the Codeguru's pages.
I found no code ready to copy but with the help of other contributors (special thanks to Mark Otway on his information on the system image list) it was not too difficult to figure out the rest by myself.
CDrvListBox is a drop down list box which shows all drives on the local computer with the same icons and names as the explorer. The control is derived from CComboBoxEx. Use it instead of a CComboBoxEx and invoke LoadItems() in the OnInitDialog() of the parent dialog. By default, small icons are displayed but you may specify ( true ) as parameter to LoadItems() to request the large icons. This will also increase the size of your edit box (automatically)! GetDataPtr() will retrieve a pointer a string containing the root path (e.g. for "Harddisk1 (C:)" this would be "C:\").
The implementation proved to be quite straight forward:
- GetLogicalDriveStrings would give me the root paths for all drives known in the system. In my application, this comes in handy when I need the result of the user's choice.
- SHGetFileInfo - when given the right paramters - gives me the display names and an index into the system image list.
- Using CComboBoxEx.InsertItem() was used to load the list - it appears to be quite similar to filling a CListView control. Important: the index for both the standard image and the selected image must be provided, otherwise the icon for a selected item will not show in either the list box or the edit field (CBEItem.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | ... and CBEItem.iSelectedImage = CBEItem.iImage = FileInfo.iIcon; ).
- Finally, the system image list needs to attached to the control.
The demo was generated with VC6.0a on NT4.0. When you compile and test, use the debug mode - I use the TRACE macros to do track error conditions and report intermediate results.