Work Place Shell Programming - Part 2
Appearance
Written by Chris Palchak
Overview
This, the second article in this series, will show you:
- the code that needs to be added to the C++ program that was generated in the first article,
- how to write a settings page dialogs in C++.
Adding the Necessary Code to the Generated C++ Stub
In the stub [chFile.cpp ChFile.cpp] file there are two important variables of which you need to be aware:
- somSelf
- points to the object on which the program is operating. In a SOM generated C++ program, use somSelf to call member functions (e.g., somSelf->wpInsertSettingsPage(hwndNotebook, &pageinfo)
- somThis
- points to the data within the object. In a SOM generated C++ program, use somThis to reference data members (e.g., somThis->lastYYYY = 1997).
In addition to the generated function headers, the following statements are generated for each function:
ChartFileGetData(...) // not modified ChartFileMethodDebug(...) // not modified return ... // sometimes modified
All other code is added manually.
Writing a Settings Page Dialog Class
The classes created to handle these settings pages are all so similar that only one of the three dialog classes will be included in this article. All settings classes include the same functions but are coded to handle the specific fields on their individual settings pages.
[StockDlg.hpp StockDlg.hpp listing]
[StockDlg.cpp StockDlg.cpp listing]
[chFile.rc ChFile.rc listing]
[chFile.h ChFile.h listing]
That's all until next month.