Building the Right Environment to Support AI, Machine Learning and Deep Learning
AbstractThe CHistoryComboEx based on the class ( CHistoryCombo) by Paul S. Vickery, which enables you to read and save the items of a ComboBox from and to the Registry. You can use it also to display the contents of a CRecentFileList object. CHistoryComboEx has the same functions of CHistoryCombo, but instead of the function (AddString()), I have added two new implements to the function (InsertItem()).
How to use it?
- Copy (HistoryComboEx.cpp and HistoryComboEx.h) to the folder of your project.
- Click on Project\Add To Project\Files... and then select the two files of our class and insert them into your project.
- Add programmatically or using the "Resource Editor" an Extended ComboBox control to your dialog.
- Using the "Class Wizard", add a member variable of type CComboBoxEx to your Extended ComboBox control. (I'll assume that your variable name is "m_cbeCtrl")
- Now open the header file of your dialog-box. Firstly, add this line to the
top of it:
and then change this line:
- Add the following line to the end of your "OnInitDialog()" or "OnInitialUpdate()" function:
This line will add key names "Addresses" to the default key of your application in the Registry. Note: You can change "Addresses" and "HistoryComboEx" to any other values.
- Add the following line to the handler, which will be running, when your application is going to be closed. (OnOK() for example!):
Here I will write a summary for the functions of CHistoryComboEx. For details please see "HistoryComboEx.cpp". Note: The documentation is the same of that one by Paul S. Vickery's "CHistoryCombo".
CString LoadHistory( LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix, BOOL bSaveRestoreLastCurrent = TRUE, LPCTSTR lpszKeyCurItem = NULL); CString LoadHistory( CRecentFileList* pListMRU, BOOL bSelectMostRecent = TRUE); void SaveHistory(BOOL bAddCurrentItemtoHistory = TRUE); int InsertItem(const COMBOBOXEXITEM *pCBItem) int InsertItem(CString strItem) void SetMaxHistoryItems(int nMaxItems); void ClearHistory(BOOL bDeleteRegistryEntries = TRUE);
The Demo shows you how to use "CHistoryComboEx" to save and load URLs.
If you have any questions or comments, please let me know!