QB Grand Championship

This entire post is a spoiler; do not read it.

QuizBusters in NeonThe week before last, my son, James, played in the Green Division Championship for QuizBusters. He was one of four players competing for East Lansing High School, the #1 seed in the tournament, and their opponents were from Hartland High School, which was (unsurprisingly) the #2 seed. It definitely looked like this would be the strongest team they had faced yet, and this turned out to be true.

In the initial, ‘Quick 10‘, round of the game, it looked like East Lansing could be on their way to another rout, taking nine of the ten questions and jumping to a 90-10 lead right away. However, that was misleading, as Hartland started a comeback with the ‘Toss Up‘ questions, during which James answered a tough question (“The 16th Amendment”) but his team uncharacteristically failed to get the first bonus question (about The Will Rogers Follies on Broadway), earning only 10 of a possible 50 points. After the first ‘Pop Quiz‘ round, the score was tied at 170, and we were getting nervous.

Fortunately, East Lansing finally hit their stride and managed to earn some sweeps, taking the next 170 points to double Hartland’s score, and from there the game never got close again. East Lansing won the Championship by a final score of 540-290, which was the closest game all season. In fact, East Lansing did not have twice Hartland’s final score, and this was the only QB game this season where they did not at least triple the opponent. The victory came complete with $5000 scholarship offers from Michigan State University, where James has already been accepted. Nice.

This past week, East Lansing faced the White Division Champions, Kent City, in the QuizBusters Grand Championship. Watching the weekly games on television, it is clear that the Green Division teams, from the bigger schools, tend to be better than the White Division teams. This game played out to form, and it really was not much of a game, East Lansing winning 530-90. However, they did complete one of their side goals for the season, sweeping all ten of the ‘Quick 10’ questions (to take an initial 100-0 lead). Of course, winning the game also added a one year book scholarship for each player, so that will help James even more.

For those interested in watching the games, the Division Quarterfinals, versus Okemos, will be aired on April 1st (no fooling), the Division Semifinals, versus Howell, will air on April 29th, the Green Division Championship will show May 13th, and finally, the Grand Championship will be shown on May 20th. All of the games are (reputedly) viewable online after they air on WKAR, and the web site also lists the full broadcast schedule for all games.

Grand ChampionsThe varsity QuizBusters team before the Division Championship.

East Lansing The East Lansing team celebrates the Grand Championship.

Vista gotchas

Watch out for some programming issues in Vista.

Now that I have Windows Vista installed and running, albeit only as a test platform, I have discovered some programming pitfalls that are not among the major issues reported. So, as a service to my readers, here are two unexpected issues that my affect the operation of some programs under Vista.

First, the standard C function, tmpfile(), does not function correctly in the more restrictive LUA (Limited User Account) of Vista, nor probably of XP. The tmpfile() function is (supposed to be) a portable routine for creating a temporary file. Unfortunately, the Visual C++ 6 implementation (at least) attempts to create the file in the program directory, to which a program no longer has write access, as opposed to a temporary directory elsewhere. The result is, simply, that the function fails. Honestly, this is not a very common function in most code, but this problem does affect some cross-platform libraries, such as certain builds of the (commonly used) JPEG library from the Independent JPEG Group, rendering some (but not all) JPEG files unreadable.

The other undocumented issue is with the Win32 API function, ShellExecute(), which is commonly used (and the recommended way) to launch document and executable files, including external web pages, from within another program. The behavior of the Vista implementation of ShellExecute() does not match that of Windows XP or earlier versions of Windows, in that it no longer recognizes a slash (/) as a directory separator. In other words, attempting to launch a file named “game/setup.exe” will work in XP and fail in Vista, whereas “game\setup.exe” (or, rather, “game\\setup.exe”, as a C string constant) will function correctly in both situations. Of course, the obvious workaround is to simply replace slashes with backslashes, but that does not help the applications that are already shipped and installed, and now broken by Vista.

I will acknowledge that this sort of problem creeps in with any operating system change by pointing out that I recently found a nice crash bug in Windows 98. If you create a dialog box with no controls, intended as a container, and then explicitly create a control with the dialog box as a parent (i.e., add a control), the program will crash in USER32 as soon the dialog box is displayed. The workaround is simply to add a hidden control to the container dialog box template, but trying to figure out why a simple call to ShowWindow() would crash a program is more than a little frustrating.

Now you all know how I spent the last couple of weeks.

Need for video games

New research provides evidence for what we already knew.

A recent article by Reuters, Video game playing may fulfill innate human need, gives some conclusions from research into the positive effects of video games, or more specifically into what makes game play compelling. This research is somewhat unusual in that it does not start with the intent to study game violence (nor the goal to prove a negative impact of games). The research was conducted by Immersyve, a “virtual environment think tank”, in collaboration with the University of Rochester (home of the “Nipple of Knowledge”).

The research, or at least the limited information available online, suggests that games can fulfill basic needs in a meaningful way, and that those games which do so “predict better psychological outcomes for players” as well as “commercial success for games.” This is one point that I made (albeit without research citations at hand) when testifying before a committee of the Michigan Senate a couple of years ago. The gist of the results, obviously, is that players who have their needs met by a game will tend to continue to play and enjoy that game, whereas players will move on from games will do not fulfill such needs as well.

Personally, I have some clear ideas about what kinds of game experiences produce psychological well-being, and I will be interested to see how my perceptions match with the research results, as well as whether there are different types of game players who respond innately to different stimuli.

Pretty Good MahJongg 2.32

This is our fourth product release in 2007.

Yesterday, Goodsol Development released Pretty Good MahJongg 2.32, an update to our unique tile solitaire game. This product contains not only traditional tile matching, with 280 different layouts (plus a layout editor), but also includes 55 different solitaire and puzzle games played with mahjongg tiles, most of which are original and exclusive to this product. One can download a 30-day trial version here.

This version of Pretty Good MahJongg, as with all of our recent release updates, provides better compatibility with Windows Vista, including a nice new program icon. Admittedly, this is the smallest of the updates, since we had already released an update back in November (2006) which added HTML Help to this title. In fact, that was the reason that we shipped the other updates (Pretty Good Solitaire 11.0.1, Action Solitaire 1.12, and Most Popular Solitaire 1.12) before this one.

One wonderful thing about our industry, and in particular, the virtual working environment, is that it is not as susceptible to certain types of business interruption (as long as ones internet connection remains functional). This release (as well as final build and testing) was published while Springfield was buried in snow. It was not substantially delayed by a driveway in need of shoveling nor by the tons of snow on the ground outside. Meanwhile, here in East Lansing, we have had relatively little snow, but we have not been forced to venture out into the very cold temperatures recently.

Anyway, this release completes all the Windows Vista updates for our major titles (though Thomas Warfield will still be updating his “Wizard” products that use the same library that we wrote for Pretty Good Solitaire). However, we still have an aggressive release schedule planned, and the fifth release is already in alpha testing. We currently have playable prototypes for the next two Goodsol titles, one needing some polish before beta testing, and the other awaiting artwork and requiring additional games to be implemented.

Everything looks positive, except this cold…

QuizBusters information

Here is some information on the most intelligent game show on television.

QuizBusters is a game show, based on quiz bowl competitions, that is produced and aired locally (to us) by WKAR, the public broadcasting station from Michigan State University. The show, now in its 17th season, is hosted and produced by Matt Ottinger. Each season, 64 teams of high school students, with 4 students on each team, compete in a single-elimination tournament, with half hour games/episodes taped over the course of several months. That, of course, means that 63 games are contested throughout the year.

One might be inclined to call QuizBusters a trivia contest, except that the answers are (usually) anything but trivial, covering mathematics, science, literature, history, geography, and other topics. The knowledge that it takes to compete, and especially to win, is impressive. Two teams, one in each division (Green Division being larger schools, and White for smaller schools) win $5000 college scholarships to MSU, and the ultimate victors also receive book scholarships.

Last year, the team from East Lansing High School won the Grand Championship, and my son, James, was an alternate (by virtue of having joined the team after QuizBusters had already started). This year, James has played every game so far and is doing quite well. Here is a summary of the results so far:

The first game was versus the Hastings Saxons, which is the alma mater of my wife, ironically. This game originally showed on January 28, but it re-airs tomorrow afternoon. It may also be viewed (reputedly) from the web site: Hastings Saxons vs. East Lansing Trojans. East Lansing won 560-140.

The next game, in what is (confusingly) called the “first round”, the opponent was Eaton Rapids. This game was first aired on February 4 and will show again on February 15. This game can also be viewed (if one has RealPlayer) here: East Lansing Trojans vs. Eaton Rapids Greyhounds. East Lansing won 650-90.

Note: Everything hereafter is a spoiler.

This victory led to the Division Quarterfinals against Okemos, a neighboring community also known for excellent schools. This game was taped on January 29 and will not air until April 1, and again April 10, so no pictures or video are available online yet. East Lansing won 630-210.

That moved East Lansing into the Division Semifinals against Howell. This game, for the honor of playing in the Division Championship, was taped tonight and will not air until April 29 and May 8. Again, the score was not particularly close. East Lansing won 630-170.

The Division Championship tapes next Tuesday, February 20, and will be against either Lansing Everett or Hartland (to be determined tomorrow). The Hartland Eagles are very good and, as the #2 seed (behind East Lansing), should be considered the favorite. The Everett Vikings, however, are one of two teams that have beaten East Lansing during Quiz Bowl league this school year, so they certainly stand a chance.

In any event, I am certainly looking forward to next week; it should be a great game.

Vista program icons

There are significant changes to program icon handling in Vista.

When I first started Windows Vista, I did not anticipate any differences regarding program icons. Although I had heard that larger icon sizes were supported, my expectations were that our traditional 32×32 (and 16×16) icons would continue to work fine. Technically, they work correctly, insofaras they are displayed and do not cause the program to malfunction, of course. However, changes in Vista render standard icons insufficient.

The first, and most obvious, change is that the default icon size on the Vista desktop is 48×48. With a standard icon, the 32×32 pixel icon bitmap is stretched to 48×48 (125% larger), which looks pretty bad in most cases. Of course, the icon sizes can be changed, and smaller settings are fine. However, a user may select a larger size than 48×48, in which case a standard icon is (get this) stretched to 48×48 and then surrounded by a frame of the desired icon size. Note that Vista does not leave the icon at the designed size, but rather stretches it to ugly first, and then puts a box around it for emphasis.

There are two places where icons are commonly displayed: 1) the desktop and 2) Windows Explorer, now known simply as ‘Computer’. On the desktop, the user can select from small (32×32), medium (48×48, default), and large (96×96) icons. In Computer, the user has additional view options, including tiles (icons shown as 48×48), details and list (16×16), and extra large (256×256). Better yet, there is a sizing slider that allows icon sizes to be set at somewhat arbitrary sizes up to the full size, 256×256 pixels.

Program icons can contain several different image sizes, at different bit depths, and a standard icon usually has 32×32 and 16×16 sizes. Vista makes use of 4 different base icon sizes: 32×32 and 16×16 are the (old) standard sizes, 48×48 is the new default size (stretched up from 32×32 if missing), and 256×256 is the full size (extra large) image that is scaled down to any size larger than 48×48 (replaced with 48×48 in a frame if missing). Fortunately, Vista fully supports 32-bit icon images (as does Windows XP) and scaling down from the full size works well.

Obviously, in order to have decent looking program icons, then, one needs to add 48×48 and 256×256 icons to the main icon resource, to handle icons displayed at the default and larger sizes. Indeed, that is the recommendation for Vista program icons, along with providing all four sizes at 32-bit (a.k.a., XP), 256-color, and 16-color bit depths. A quick calculation shows that, while the (9) images for the three smaller sizes take only 19.25K of data, combined, the full size (256×256) icons take 352K of data. To help reduce this overhead, the ICO file format was extended to support PNG compression. This is all described in this good tutorial by Axialis Software; unfortunately, there is one major omission.

Based on the published recommendations, and having received new icon artwork just for the occasion, we licensed an icon editor that supported Vista icons, generated a new .ICO file, and then naively replaced the old standard icon with this new Vista-ready one. All it would take was a quick rebuild and…

error RC2176 : old DIB in vista.ico; pass it through SDKPAINT

No dice (and there is nothing at all on my development system named ‘SDKPAINT’). With some frustration, I launch Visual Studio 2005 and (lo and behold!) the latest development environment from Microsoft produces the same error. Really. Some research shows that the only current way to add a proper Vista icon is by adding or replacing an ICON resource to a compiled executable file. Fortunately, make that very fortunately, there is a tool available on The Code Project to do exactly this.

So, with the ‘ReplaceVistaIcon’ tool installed as a post-processing step to my build (in Visual C++ 6.0), the program builds fine and the icon works as desired in Windows Vista. Tip #1: When updating an existing project, insert two copies of the old standard icon in the program resources. The new Vista icon can replace the first (default), but users will still be able to manually select the older icon if desired. Tip #2: To clear the (aggressive) Vista icon cache, change the default font size (i.e., to or from large fonts). This requires a reboot, but it does the trick.

There was one final concern, that turns out to be a non-issue. In my research, I found reports that Windows 98 would reject any icon that contained images larger than 72×72, so programs with Vista icons would not work on Win98 machines. Fortunately, my testing indicates that this is simply false. Of course, the 256×256 icons cannot be displayed on older systems, but they read and recognize the 32×32 (and 16×16) images just fine. (I did not test this under Windows 95, however.)

Well, there you have the tricks to getting decent program icons under Vista. Once you know them, the process is pretty simple, but finding all the issues takes some time. Hopefully, this article will help you save a little time and avoid the same pitfalls.

Most Popular Solitaire 1.12

This is our third 2007 product release, of several planned.

Yesterday, Goodsol Development released Most Popular Solitaire 1.12, an update to our traditional card solitaire title, which (as the name suggests) includes 30 of the most popular solitaire games of various types. This version is a maintenance update primarily intended to provide better compatibility with Windows Vista. A 30-day evaluation copy can be downloaded here.

Unlike the other major products, the version number is not displayed prominently on the Most Popular Solitaire web site. This title is positioned as a piece of software for players who want to be able to play a fair variety of popular types of solitaire, or patience, without needing the (sometimes overwhelming) variety provided by Pretty Good Solitaire (PGS), which currently has 660 different games, with more on the way.

Although Most Popular Solitaire (MPS) seems to be something akin to “PGS Lite”, under the hood it is actually considerably different from its older, more established, brother. The two games use entirely separate engines that are not even written in the same language. MPS is written entirely in C++ (using Visual Studio 6.0) and was actually based more on the code from Pretty Good MahJongg and Action Solitaire, than from PGS. Still, most of the design was derived from the flagship product, as it should be.

This deep into the Vista update schedule, we finally have most of the glitches worked out, and this release went smoothly, with the first installer build passing muster. I still have a list of Vista lessons learned during this process to share. Next up… Icons.

WinHelp versus HtmlHelp code

Here are the simple instructions for converting C/C++ code for Vista help.

Most Windows programs have simple help requirements, and the WinHelp() function within the Win32 API used to provide all of the necessary functionality. Although the documentation shows 18 different instructions, most common operations boil down to one of three primary functions: displaying the help file with a default topic, showing the contents of the help file, or displaying a specific help file topic.

WinHelp ( window, “filename.hlp”, HELP_CONTENTS, NULL )
WinHelp ( window, “filename.hlp”, HELP_INDEX, NULL )

These commands show the default contents (a.k.a., index) page of a help file. In Win32 projects, these commands are identical, the latter remaining from an older (16-bit) incarnation of Windows Help. Contrary to implications in the documentation, these are not superseded by the HELP_FINDER command; these display a default help page, whereas the “preferred” method (below) shows a separate keyword index.

WinHelp ( window, “filename.hlp”, HELP_FINDER, NULL )

This command shows a keyword index for a help file, which generally means that it opens the “Contents” tab with a scrollable list of keywords. In Win32 projects, the HELP_KEY command can also be used to open the “Find” tab, although this use was unusual except as a leftover from older (16-bit) projects.

WinHelp ( window, “filename.hlp”, HELP_CONTEXT, context )

This command shows a specific page of the help file, based on the ‘context‘ parameter. This is the standard and straightforward method of providing context sensitive help.

Of course, there are other WinHelp commands, and each use will need to be individually evaluated. However, if a project still uses the HELP_HELPONHELP command, then it can probably be removed completely, along with any menu option or other element that invokes it. This opens a generic help page, “Help Topics: How to Use Help”, which is truly one of those seemed like a good idea at the time situations. I would be surprised if any Windows user, ever, opened this help topic in earnest (though quality assurance sure did).

Now, along comes Windows Vista, which no longer supports WinHelp, and instead essentially forces us to use the HtmlHelp() function. The newer HTML Help (.CHM) files now (usually) show the help files in a dual-pane window, with the “Contents” and “Search” tabs on the left and the help page on the right. This means that the 19 listed HtmlHelp commands (which omits HH_HELP_FINDER) can be distilled down to only two basic calls.

HtmlHelp ( window, “filename.chm”, HH_DISPLAY_TOC, NULL )

This command displays the default help topic, and since the index and search features are contained in the left pane, this allows access to all of the basic help functionality. This can replace any WinHelp calls using HELP_INDEX, HELP_CONTENTS, or HELP_FINDER, and may allow some interface simplification if there is duplication among these commands.

HtmlHelp ( window, “filename.chm”, HH_HELP_CONTEXT, context )

This command displays a specific page of the help file, based on the ‘context‘ parameter. This is a direct replacement for WinHelp calls using HELP_CONTEXT to provide context sensitive help.

Incidentally, the HTML Help API is the most poorly documented common API that Microsoft supports. The HtmlHelp() function, the heart of the API, does not even have a normal help page itself, like every other Win32 function. To get the header and import library files, one needs to download either the Platform SDK (up to 400M), or the HTML Help 1.4 SDK, which is alternately (and confusingly) identified as HTML Help Workshop 1.3 or 1.31. Everything about this feels like an afterthought.

Once the HtmlHelp() calls are in the code (or before, if you prefer), two additional changes need to be made to the C or C++ code. First, the header file (htmlhelp.h) needs to be included:

#include <htmlhelp.h>

Then, the import library, htmlhelp.lib, needs to be added to the project. Normally, this would be done in the “Link” section of the project settings. However, just for giggles, here is a line of code that will add the necessary library to the list of default libraries for a particular object file (in Visual C++):

#pragma comment ( lib, “htmlhelp” )

With the header file included, your code should compile, and with the import library added (via either settings or pragma), it should link as well. This, of course, assumes that the development system already has these file available to the compiler and linker, respectively (and if not, see the download link above).

Well, that is pretty much all there is to converting WinHelp source code to HTML Help to provide support for Windows Vista. Of course, one should always check return values and perform proper error handling. In the above cases for HtmlHelp, the return value is an unnecessary window handle in the first case, and not documented at all (told ya!) in the second, so casting the return value to “(void)” may be acceptible.

Finally, the sketchy HTML Help API documentation could lead one to implement HH_INITIALIZE and HH_UNINITIALIZE commands, which in turn would require a HH_PRETRANSLATEMESSAGE command to be inserted into the program loop (to allow the help window to function). Our research suggests, and testing confirms, that this extra work is only necessary if one is using embedded help and, hence, need to force execution to a single thread. (Reference KB194116 and comments by former Microsoft help developer, Ralph Walden.) Likewise, it is also unnecessary to use the HH_CLOSE_ALL command on program exit, as HTML Help will automatically close the help window.

Any questions?

Vista help files

Windows Vista does away with trusty old WinHelp.

The first and most obvious limitation of Vista, by design, is that the new operating system no longer supports WinHelp, the trustworthy help system that we have been using under Windows for well over a decade. There is no backward compatibility here; instead, programs are encouraged to use HTML Help. Fortunately, the minimum platform for HTML Help is Windows 98, or Windows 95 with Internet Explorer 4 installed, so support is none too onerous (though forcing us to change is somewhat distasteful).

The lack of WinHelp support has been documented quite well, but what has not been published as widely is the practical result when attempting to open a standard .HLP file under Vista. Fortunately, it is not a disaster for most publishers, since Windows attempts to explain the problem (rather than causing the program to crash). When a WinHelp file is referenced, Vista displays an HTML Help window with the following topic and text:

Why can’t I get Help from this program?

The Help for this program was created in Windows Help format, which was used in previous versions of Windows and it is not supported in Windows Vista.

For more information, see Windows Help program (WinHlp32.exe) is no longer included with Windows on the Microsoft support website.

Note that this knowledge base article does not, as of this writing, provide the promised download location for a viewer for WinHelp files. It does, however, go out of its way to make it clear that we developers may not redistribute this tool, a prohibition which seems rather pointless given that Microsoft has not finished it yet. Perhaps they should develop a product first before starting to exercise intellectual property rights.

The WinHelp solution that Microsoft proposed, that a publisher could send a user to a download location to get a viewer that would allow that user to view the help file, is clearly not viable, now that Vista is in general release without the requisite viewer. Therefore, it becomes necessary for a publisher to generate an updated version of all supported products that must be converted to use HTML Help instead of WinHelp.

Fortunately, most professional help editors for Windows now have support for both WinHelp and HTML Help, as well as other formats in many cases. Here, we use Help & Manual 4.2, by EC Software, which made short work of conversions from .HLP to .CHM files, even where the original source files were not available, though I know that other tools, such as HelpScribble from Jan Goyvaerts of JGsoft, would work as well.

Converting a help file from WinHelp (.HLP) to HTML Help (.CHM) is the data half of the battle. Tomorrow, I will provide the simple (C/C++) details for modifying source code to call the newer help file format. The code changes are definitely simple for a basic help system, making that the easier half.

Happy Woodchuck Day

It is now time for a Spring festival in the heart of Winter.

Today, here in the United States (and Canada as well), it is Groundhog Day. On this day, little furry varmints are pulled out of their cages to participate in a quasi-traditional rite of prognostication, the results of which are no doubt influenced adversely by human participation.

At this moment, the digital thermometer says that it is 17 degrees F, and feels like 4 degrees F. My wife says that the Celsius scale works better in these temperatures, because it feels negative, so those numbers are -8 C, with a wind chill of -16 C. Winter only arrived in the last few weeks, and the lakes are not even frozen (i.e., enough for racing) yet.

In honor of Punxsutawney Phil (who apparently did not see his shadow and, therefore, predicts an early Spring) and the rest of the poor critters who were unwillingly forced out into this weather today, I will now crawl back under my covers to indicate my own prediction.