( Index )
Month

Brief Information about the December 97 CSIG Meeting

Mouse Clicks with M.F.C. ... by James Carr

Tick Tack Toe Board

Leader: Bruce Arnold (b a r n o l d @ b l a s t . n e t)

Summary by: Ron Murawski (the_murs@pipeline.com)


User Group News

C/C++ User Group

December's C/C++ meeting was on the third Tuesday of the month. It began with a Random Access section where all questions and comments are welcome. One member complained of an "unexpected abort" message when accessing the printer setup menu from a database program. The cause seemed indeterminate: either a misconfiguration of the database program or an error buried deeply within the Windows registry. Later several database programs were discussed. Another member mentioned he was currently working with the C-like JavaScript language and struggling to write code that would run on both the Netscape and Microsoft browsers. It seems you have to code extremely carefully for the finicky Microsoft browser.

December's main presentation was by James Carr. He explained the inner workings of the source code to a Microsoft Systems Journal (MSJ) article written by Windows programming expert Jeff Prosise. The article was called "Programming Windows 95 with MFC, Part III: Processing Mouse Input". It appeared in the August 1995 issue of MSJ.

James explained that the "MFC" part of the title refers to the Microsoft Foundation Classes. MFC is a C++ class library for Windows. Its purpose is to make the task of programming Windows easier. MFC provides abstractions of complex features that, once understood, allow for simpler coding than the older Windows API calls.

James showed that the most glaring difference between programming the old way (API) and the new way (MFC) is in the message handling code. Whereas with API programming you must use convoluted callback handlers and message crackers, with MFC you simply enumerate the messages you intend to handle and then, function by function, create them to handle each message.

The demonstrated program plays tic-tac-toe. A left-click places an "X" and a right-click an "O". Legal moves are enforced and wins are detected automatically. The declaration of the functions: OnLButtonDown and OnRButtonDown were as simple as James promised they would be. With separate functions to handle each event, much of the complexity that is found in a typical API program vanished.

The source code and executable are available from the ACGNJ ftp server at:

See SOURCE CODE links below.


"Random Access" questions start at 7:30 Tuesday night.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page