I have a pretty large and old application where the user can select the current customer from a combobox. However, the number of customers have grown (>100) to the point where the users think that selecting a customer from the list is awkward.
Does anyone have a good suggestion for a replacement for a CComboBox? The droplist portion should be a multilevel menu or a tree or similar ... I have seen several attempts here and in other places, but they all seem pretty experimental (non-standard UI behaviour, hardcoded drawing functions not utlizing themes, and so on).
You could use the same idea that a lot of websites use, in that they build their lists dynamically as the user types into them. So if the user starts typing a you just load all the customer names from that sub group. Here are some CodeProject articles[^] that discuss the issue.
One of these days I'm going to think of a really clever signature.
Thanks for the input, using some kind of incremental search could be an option.
However, my query was for a custom control with similar functionality as a CComboBox, but where the list box (the dropdown part) is replaced with a tree control or a menu with submenus. There's several examples here at codeproject, but I don't find any of them really cut for the job. It seemed like a pretty common problem, so there should definitely be someone out there having solved it.
Open workspace by VC6 IDE, RC is not loaded and RCF and RCF are display as a file name in workspace but empty，why？how should I do for doing this work well。
Change macro definition as below,result is same
What are you trying to achieve by doing this? ...I don't remember having to edit this file directly ever, you should be able to make any changes regarding project files and compilation changes from the IDE.
SetupDiGetDeviceRegistryProperty API suppose returns required buffer size for "Property" beeing inquired about.
It does but it also returns variety of errors.
( invalid data, data "too short" - whatever that means )
The function never returns true when with parameters are set to return buffer size.
Is that normal?
For example if I inqiure about SPDRP_FRIENDLYNAME the buffer size returned is 0.
Here is my code, keep in mind it is a test code!
I have aslo included partial MS function desription.
PropertyBuffer [out, optional]
A pointer to a buffer that receives the property that is being retrieved. If this parameter is set to NULL, and PropertyBufferSize is also set to zero, the function returns the required size for the buffer in RequiredSize.
The size, in bytes, of the PropertyBuffer buffer.
RequiredSize [out, optional]
A pointer to a variable of type DWORD that receives the required size, in bytes, of the PropertyBuffer buffer that is required to hold the data for the requested property. This parameter is optional and can be NULL.
SetupDiGetDeviceRegistryProperty returns TRUE if the call was successful. Otherwise, it returns FALSE and the logged error can be retrieved by making a call to GetLastError. SetupDiGetDeviceRegistryProperty returns the ERROR_INVALID_DATA error code if the requested property does not exist for a device or if the property data is not valid.
I've just tested it and got also FALSE returned when requesting the size. The returned error is 122 / ERROR_INSUFFICIENT_BUFFER. So it seems that this is intentional.
But you must check the error code (e.g. when passing NULL for PropertyBuffer and a value greater NULL for PropertyBufferSize, code 87 / ERROR_INVALID_PARAMETER is set and the returned size is set to the passed value).
If you got other errors like ERROR_INVALID_DATA, check your parameters. Note that the size member of the DeviceInfoData parameter must be initialized:
Here is some of the "calling code", still in test development.( I know it is a mess. sorry)
If I just use this property DWORD Property = SPDRP_DEVICEDESC;
I still get error when looking for the buffewr size only,
but get the size OK.
Than I get another error - something "the parameter passed to the system is too small". I am trying to find some explanation for this error just for the SetupDiGetDeviceRegistryProperty.There are tons of posts about this error , but nothing specific for this function I found so far.
What bugs me is that ewerybody is copying the original MS device iteration sample code and set the buffer to value and when it fails ( allegedly for Win2000 only ) they increase it. That tells me that the setting for finding the buffer size may not really work, hence all these errors.
Thanks for all you help, appreciate it.
CString strLabel = "Friendly name ";
TRACE("\nCreate a HDEVINFO with all present devices");
TRACE("\nSetupDiGetClassDevs... Create a HDEVINFO with all present devices");
hDevInfo = SetupDiGetClassDevs(
0, // Enumerator
DIGCF_PRESENT | DIGCF_ALLCLASSES);
// Enumerate through all devices in Set.
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
TRACE("\nSetupDiEnumDeviceInfo...Enumerate through all devices in Set");
A handle to the device information set for which to return an SP_DEVINFO_DATA
structure that represents a device information element.
A zero-based index of the device information element to retrieve.
A pointer to an SP_DEVINFO_DATA structure to receive information about
an enumerated device information element. The caller must
set DeviceInfoData.cbSize to sizeof(SP_DEVINFO_DATA).
for (i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData); i++)
//LPTSTR buffer = NULL;
//DWORD buffersize = 0;
//TRACE("\nShow property using friendly name flag");
TRACE("\nTest show device description ");
DWORD Property = SPDRP_DEVICEDESC;
/* enumerate all properties test