Bowmain Consulting

Miscellaneous
Part of Project Denning

Naming Conventions

The project mostly uses a MFC-like naming convention. I.e. capital letters are used for classes, methods, members and local variables. Member variables are prefixed by "m_". Single word variables are usually lower case. I'm not a zealot about naming conventions - and it is almost impossible to be consistent when programming in C++ on Windows. MS themselves are not consistent, some of their code uses Camel case, some not. The STL uses a yet another convention!

Formula OneGrid Control

The current application uses a very old version of the Formula One grid control. It was purchased in the mid-1990s. There are a number of issues with the use of this control:

  1. The control is proof of the vast strides made in commercially available components. Although it does a very good job of aping EXCEL, the functionality is not as complete as that available with modern controls. For example, colour support is minimal - cells and text can be any colour you want as long as it is one of 16 basic colours. It is not possible to allow users to alter the width of columns, or to rearrange them. It would be nice to replace the control on this basis alone.

  2. The control has some nasty behaviour. In particular, many of the formatting functions require the affected area to be "selected". presumably copying Excel. If the selection is set inside an event handler, the stack overflows. Unfortunately that's exactly where it is most logical to alter the appearance of the displayed data in response to user input.

  3. There is a licencing issue. The Formula One control is a commercial product. It is not free. If the control and header files were included in the distribution, there would be a breach of the original licencing agreement. But this is an open-source project - without the control and headers the project cannot be independently built! What should be done?

    Formula One allows the control to be distributed with applications. The control is wrapped so that the project does not use the Formula One header files, and only the functionality required by this application is exposed. I.e. the control is knobbled so that it can't realistically be used in other projects.

    The control wrapper source files (CTLSS.CPP and CTLSS.H) are available, however the application cannot be built using these files. CTLSS.H contains knobbled grid control interface. Users must link with the VTSSWND.OBJ and CTLSS.OBJ object files included in the project. Alternatively, download a binary.

The interface defined in CTLSS.H should facilitate any change in the choice of grid control.

C++ / .NET interoperability

Download sample code to call C++ managed code from C++ client and C# client.

Programmatically adding an ODBC Data Source

Have you ever wonder how to check whether ODBC is installed, or whether the appropriate driver is present, or how to add an ODBC data source programmatically? Download ODBCUTIL.H and ODBCUTIL.CPP. The code provides functionality similar to VB's RegisterDatabase. (Tested on my machine - Window 2000 Advanced Server, ODBC 3.520.9042.0)

Copyright Bowmain Ltd, 2004, 2005.