Back to Entering Code
Create GUI Project
Select Solution
Right Click -> Popup Menu -> Add-> New Project...
On the popup Create Dialog
Visual C++ tab select Template MFC Application
Name field enter GUI
Location field enter <Drive>:\<Path>\ HelloWorld (specify the path to the HelloWorld directory)
Solution field enter GUI (this should be automatically filed in by the dialog)
Tick CreateDirectory for Solution
Select OK
On MFC Application Wizard
Select Dialog Based and MFC Static Library
Untick Use Unicode Libraries
Select Finish
For this example all other options are defaulted.
This step will create all of the required GUI files with a default Dialog. For this application we do not need to change the Dialog.
Set up GUI Properties
These properties are for the debug build (release are similar)
Select the GUI project in the Solution Explorer Window. Then select Right Click -> Popup Menu -> Set as Startup Project.
Select Debug from the Build Configurations Option
Select the GUI project in the Solution Explorer Window. Then select Right Click -> Popup Menu -> Properties...
On the popup Properties Dialog
C++ tab
General tab
Additional Include Directories field enter ../HelloWorld;$(COREDIR)ClipRT
Preprocessor tab
Preprocessor Definitions field add ;CLP_PLATFORM_WIN32
Pre-compiled Headers tab
Create/Use Pre-compiled Header select Dont Use Pre-compiled Headers
Linker tab
General tab
Output File field modify name to include _d.exe
Additional Library Directories field enter ../AutonomousDebug
Input tab
Additional Dependencies field enter nafxcwd.lib HelloWorld_ad.lib
Select OK
Basic Modifications to GUI Code
Select files from the Solution Explorer file tree and make the following modifications
Gui.cpp
Modify dialog creation in InitInstance() to
BOOL CGUIApp::InitInstance()
{
...
CGUIDlg* dlg = new CGUIDlg();
m_pMainWnd = dlg;
dlg->Create( IDD_GUI_DIALOG );
return TRUE;
}
GuiDlg.h
Modify the Dialog definition to include
class CGUIDlg : public CDialog
{
...
protected:
...
LRESULT DefWindowProc( UINT message, WPARAM
wParam, LPARAM );
afx_msg void OnClose();
};
GuiDlg.cpp
Modify the Dialog file to include
#include <projectheader.hpp>
#include <Process1Process_includes.hpp>
#include <GUI/Win32/CPP/Include/Win32_Process.hpp>
Comment out or remove
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
Add Close to message map
BEGIN_MESSAGE_MAP(CGUIDlg, CDialog)
...
ON_WM_CLOSE()
END_MESSAGE_MAP()
Add dialog registration and process startup to OnInitDialog()
BOOL CGUIDlg::OnInitDialog()
{
...
// TODO: Add extra
initialization here
::CLIP::SetCallbackWindow( this->GetSafeHwnd(), this );
Process1Process* process = new Process1Process();
process->Startup();
return TRUE;
}
Add overrides for dialog functions
LRESULT CGUIDlg::DefWindowProc( UINT
message, WPARAM wParam, LPARAM lParam )
{
CLIP::ProcessPumpMessage( message, wParam, lParam );
return CDialog::DefWindowProc( message, wParam, lParam );
}
void CGUIDlg::OnClose()
{
ClpExit(0);
CDialog::OnClose();
}
We can now Build and Test the application