WriteLog Contest Module Development – Part 2: The Contest Wizard

In part 1, I outlined the tools you will need to write a contest module for WriteLog. At this point, the steps needed to set up the wizard have been done. If not, review the WriteLog contest wizard read-me file to install the template, set the Path in the Windows environment, etc.

The Contest.

Look carefully at the rules for the contest you are developing a module for. For this walk-through, I’m using the exchange from the SKCC Weekend Sprint rules, http://www.skccgroup.com/sprint/wes/. The exchange consists of CALL, RST, NAME, SKCC NUMBER, and QTH. The QTH is a once per contest multiplier using States, Provinces, and three character codes for DX (as defined by the United Nations). It’s a simple exchange with some quirks to make it interesting. One interesting thing about SKCC Sprints is the bonus points you get for working Centurians and Tribunes, 5 and 10 points respectively, once for each SKCC number per contest. The SKCC number will end with a C or a T for one of those honored operators.

The Wizard.
In VC++, create a new contest project using the WriteLog Contest Wizard. Change the project’s Location to the folder named, “writelog” that was in the contest wizard zip file.

Contest Wizard Template

After you click OK, the WriteLog Contest Wizard displays. Select the RST in exchange option, Mults As you go, and Named Mults. Don’t use DXCC because the rules say to use the ISO three letter country designator as the QTH. The multipliers are not ‘By Band’ because you only get to use the multiplier once per contest. Add those to the named multipliers instead of using country data. We’ll be using Mults As you go to keep score of SKCC Centurion and Tribune numbers. Leave the Class name as it is. Fill in the Contest Name and 0 for the GUID. The SKCC contest doesn’t need Cabrillo support but I’m adding it because a lot of contests support this option.

WriteLog Contest Wizard

The Generated Code.

After you click the Finish button a pile of code will be generated for you. Add the Dxpref32.lib and wlogsh32.lib to the project Source Files as described in the contest wizard read-me. Now, do Edit|Find in files and search for “TODO.” You should get a list of more than 30 occurrences.

Start with the easy items in the list. Skip down past the resource files (*.rc).

  • Change the ID string in SKCCWESMm.h from “TODO” to “SKCCWES”
  • Change the MAX_NAMED_MULTS constant to 292 (the count of States, Provinces, and country codes).
  • Set MAXAYG to 400. I don’t know what the world record for QSO count is here but 400 seems plenty from looking at past results.
  • Set the AYGSTRING_WIDTH to 6 to accommodate an SKCC number (4 digits plus room for a C or T and the null for a ZSTR).
  • Run GUIDGEN and replace the one in SKCCWESMm.h. Copy “CLSID_SKCCWESMmd” and replace “<>” with it. Get rid of the old GUID place holder.
  • Change the number of bands in SKCCWESdat.cpp to the bands listed in the rules, 160 through 6m CW by setting NUM_BANDS to 7 and changing the band_stru array to the list of allowed bands and CW mode.
  • Just delete the TODO comment for the PointsForQso() method in SKCCWESmm.cpp. Each Q is worth 1 point.
  • Change the string in the Display() method from “TODO” to “SKCC Mults”.
  • Edit the switch statements in FormatTxField() and FormatRxField() changing the second occurrence of 0 to 2.

    Edit the block of _POS constants. The actual order is not important because these just define their position in an array, not their position in the log or on the screen. Delete or comment out the #error line just above the list of _POS constants.

    #define RS_POS 0 //TODO
    #define SN_POS (RS_POS + RS_WID)
    #define RCVD_POS (SN_POS + SN_WID)
    #define MLT_POS (RCVD_POS + RCVD_WID)
    #define AYG_POS (MLT_POS + MLT_WID)
    #define AYGMULT_POS (AYG_POS + AYG_WID)

    More changes will have to be made later but for now the project will compile without errors.

    Now that the project will build, go ahead and compile it and do a Tools|Register Control in VC++. Change the Executable for debug session on the Debug tab in the project settings with the path to the main WriteLog program. With that set, we can run the contest module in the debugger and step through the code as WriteLog runs.

    Project Debug Settings

    At this point in the journey we have built the framework for the contest module, made a few edits, and compiled the code without errors. Now we leave the lowlands and begin to climb.

    WriteLog is Copyright © 1992-2009 by Wayne E. Wright, W5XD.

    Creative Commons License
    This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

  • 2 responses to “WriteLog Contest Module Development – Part 2: The Contest Wizard”

    1. Wayne, W5XD

      Don: this is a very nice teaching guide for starting a WriteLog module.

      It is worth noting as an advanced topic that the wizard dialog does not cover every possible combination of variations that contests might have in their rules. And there are a few interfaces between WriteLog and its modules that the wizard does not setup for you. So sometimes it is useful to read through iwritelg.h and add an interface by editing your C++ class directly. The wizard works, and can be used to create a first pass at the sources, but another way to use the wizard before starting work in earnest is to run the wizard a couple of times with various settings and then “difference” the resulting files. (I use winmerge from http://winmerge.org)

      It also helps to run your module and WriteLog under the debugger and set breakpoints in your module’s entry points. One thing you must know in order to avoid confusion, though, is that WriteLog will call your module not only when the operator makes keystrokes or other input, but also when packet spots arrive, or for super check partial scans, and for other checks that are not correlated with operator input. It can be difficult to tell why WriteLog is calling, so its helpful to turn off super check partial, packet, etc. when first debugging a new module.

      As a last resort when you are confused, you can send an email to w5xd@writelog.com. But the email must be a detailed question about exactly what you are trying to do and why it appears not to work. An email that can be paraphrased only as “it don’t work” probably won’t get an answer from me.

      Wayne, W5XD

    2. AC7FA » Blog Archive » WriteLog Contest Module Development - Part 4: The Exchange Entry Box

      […] you create a contest log with this module right now, you would see where these fields are used. In part 2, I demonstrated how to set up VC++ to run WriteLog when you hit F5 to run the program in the […]

    Leave a Reply