Jump to content

Work Place Shell Programming - Part 2

From EDM2
Revision as of 01:20, 24 February 2012 by Martini (talk | contribs) (Created page with "Written by Chris Palchak {| width="400" cellpadding="4" | align="CENTER" valign="MIDDLE" | Part 1 | align="CENTER" valign="MIDDLE" ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Written by Chris Palchak

Part 1

Part 2

Part 3

Part 4

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.