C SDK

The Consoul library being a Windows DLL, using it with a language like C or C++ is happens by directly using the API documented in the reference section of this documentation.

Compiling

Add the provided ".lib" files in the downloads section to your linker options.

You can add the consoul.h header file from the SimpleConsole demo application presented below in your includes.

If you're going to use callbacks in your application, you can copy the "callbacks.h" and "callbacks.c" files in your project and adapt them to your needs.

SimpleConsole sample

Source code for the application is available on this github page.

Binaries are available in the downloads section; SimpleConsole.exe needs the Consoul 32bits dll also available there, which has to be placed either in one of the PATH environment variable directories, or in the same location as the application.

The SimpleConsole application demonstrates how to create a console window, how to handle zone paint events, surface paint events and how to control interaction from the parent windows like responding to keyboard messages from the parent window.

Screenshot

Each line where "Hello World!" appears show a colored rectangle preceding the word "World". This rectangle is drawn using the zone paint event (see th callbacks.c file).

The word "World!" is contained in a zone, number (or id) 100. Moving the mouse cursor over the word changes its shape to the hyperlink pointing hand; clicking it reverts the letters of the word. Code for handling this behavior is also to be found in the callbacks.c file.

The SimpleConsole sample also show sample code to save the visible part of the console windows to a windows bitmap file. Alternatively, the full of partial content of the console window could have been grabbed in a windows display context using the CSPaintOnDC Consoul API, but that would require additional code to create and size the display context somewhere else, and then saving the display context in a bitmap file with a similar technique as the one used in the SaveConsoul function in SimpleConsole.c.

Last updated: May 14 2022.