Feedback Search Top Backward Forward

Work Place Shell Programming - Part 2/4

Written by Chris Palchak


Part1 Part2 Part3 Part4


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 file there are two important variables of which you need to be aware:

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

StockDlg.cpp listing

ChFile.rc listing

ChFile.h listing

That's all until next month.