YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
View in English
View in Japanese
View in
참고
View in Français
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


VC++ Example: CComboBoxEx with History, ComboBox, CComboBox to history!

 
 By Nabil Hussein

Abstract

The 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?

  1. Copy (HistoryComboEx.cpp and HistoryComboEx.h) to the folder of your project.

     
  2. Click on Project\Add To Project\Files... and then select the two files of our class and insert them into your project.

     
  3. Add programmatically or using the "Resource Editor" an Extended ComboBox control to your dialog.

     
  4. Using the "Class Wizard", add a member variable of type CComboBoxEx to your Extended CComboBox control. (I'll assume that your variable name is "m_cbeCtrl")

     
  5. Now open the header file of your dialog-box. Firstly, add this line to the top of it:

     
    #include "HistoryComboEx.h"

    and then change this line:

    CComboBoxEx   m_cbeCtrl;

    to:

    CHistoryComboEx m_cbeCtrl;
  6. Add the following line to the end of your "OnInitDialog()" or "OnInitialUpdate()" function:
     
    m_cbeCtrl.LoadHistory("Addresses", "HistoryComboEx");

    This line will add key names "Addresses" to the default key of your application in the Registry. Note: You can change "Addresses" and "History ComboEx" to any other values.

  7. Add the following line to the handler, which will be running, when your application is going to be closed. (OnOK() for example!):
     
    m_cbeCtrl.SaveHistory();

That's all!

Functions

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);

Example

The Demo shows you how to use "CHistoryComboEx" to save and load URLs.

If you have any questions or comments, please let me know!

Downloads

Download source - 49 Kb
 

 

 

Copyright ?1998-2024 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net