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
- Open an existing MS Visual Studio Solution containing a Blueprint project or create a new one (see Creating a Project)
- Select File | New->Project from main menu or Add | New Project from the solution
- Select Visual C++ from the Project types list and then MFC Application from the Visual Studio installed templates
- Enter a name and path and select OK.
- 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).
- Select Finish.
The picture below shows MS Visual Studio after creating a Blueprint Project EgProj and a GUI Project GUI.
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)
- Convert the generated MFC modal dialog to be non-modal (optional - but recommended)
- Modify DefWindowProc to send pump messages to CLIP
- Include your Blueprint process-includes header
- Register your window and call-back object with CLIP
- Start your process
- Add a CLIP diagnostic handler (optional - but recommended)
- Remove the generated redefinition of new
- Add the CLP_PLATFORM_WIN32 preprocessor directive
- 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
-
Although Single document & Multiple documents application types are valid, they are beyond the scope of this documentation.
-
When creating an MFC Dialog based application MS Visual Studio will present a number of additional configuration dialogs, which should be configured as required by your application.