Blueprint Help Send comments on this topic.
Creating the Main Application
See Also

Glossary Item Box

Overview

The main application is any standard application that needs to instantiate a Blueprint library in order to use its functionality.  Typically this application presents a Graphical User Interface (GUI) to the end-user through which they can receive visual feedback and invoke the application's behavior but it could also be a simple console application.

This section describes how to create a simple dialog-based MFC application and interface to a Blueprint library.

Creating the Main Application

  1. Open an existing MS Visual Studio Solution containing a Blueprint project or create a new one (see Creating a Project)
  2. Select File | New->Project from main menu or Add | New Project from the solution
  3. Select Visual C++ from the Project types list and then MFC Application from the Visual Studio installed templates
  4. Enter a name and path and select OK.

  1. In the options dialog set Dialog Based and Static MFC library (other user interface options can be set up at this point, but are not relevant to this guide).

  1. Select Finish.

The picture below shows MS Visual Studio after creating a Blueprint Project EgProj and a GUI Project GUI.


EnlargeClick to enlarge

There are no restrictions or modifications required for the GUI dialogs themselves, so you can design them in the usual way (see the MFC developers manuals).

Interfacing to a Blueprint Library

To invoke the functionality of your Blueprint library you will need to perform the following actions (detailed in Interfacing a Blueprint Library to a GUI)

  1. Convert the generated MFC modal dialog to be non-modal (optional - but recommended)
  2. Modify DefWindowProc to send pump messages to CLIP
  3. Include your Blueprint process-includes header
  4. Register your window and call-back object with CLIP
  5. Start your process
  6. Add a CLIP diagnostic handler (optional - but recommended)
  7. Remove the generated redefinition of new
  8. Add the CLP_PLATFORM_WIN32 preprocessor directive
  9. Add your Blueprint Library to your MFC Application's project dependencies or alternatively, manually link the library.

Creating Event Handlers

Blueprint circuits can supply events to the main thread of the application via objects called call-back functions.  When placed in a circuit a call-back function object causes a Process function to be executed by the main application thread when a CLIP event arrives at its trigger face.  This Process function can then invoke event handler functions provided by the GUI dialog and pass data from the within the circuit to the dialog for display.

Creating these event handler functions and calling them from Process is described in detail in Interfacing a Blueprint Library to a GUI.

Creating Interface Functions

In addition to receiving notification when a CLIP event fires, the main application can also request and wait on an event.  This causes the main application thread to block until the event is produced, at which point the main thread has access to the information contained in the event.

Creating interface functions and using them is described in detail in Interfacing a Blueprint Library to a GUI.

Interfacing with .NET

Interfacing with a .NET GUI follows a similar process to that described above but in addition it is necessary to wrap your Blueprint Library/Libraries in a DLL to enable them to be imported into your chosen .NET language.  You will also need to martial any data types across the managed/unmanaged boundary.

Notes

 

See Also