IBM Support

Example of using IBM Rational Rose RealTime for developing MFC applications

Troubleshooting


Problem

IBM Rational Rose RealTime can be used for creating MFC (Microsoft Foundation Class) applications. Attached is an example that demonstrates how Rose RealTime can be used for MFC application development.

Resolving The Problem

IBM® Rational® Rose RealTime can be used for creating MFC (Microsoft Foundation Class) applications. Attached is an example that demonstrates how Rose RealTime can be used for MFC application development.


SimpleApp
---------

This is a Rose RealTime model used to develop an MFC application. It is a very simple application but it demonstrates how one could use Rose RealTime's modelling capabilities to produce an application using MFC. This model contains the MFC6Classes so it could also be used to create a framework.

Here are the steps to see the example:

1) Unzip the attached file (e.g. to C: drive) then set the SAPP_DIR pathmap in Rose RealTime to be this directory.

e.g. From the Menu - File > Edit Path Map

$SAPP_DIR = C:\simpleMFCApp


2) In the model, build the simpleapp component, this demonstrates a simple dialog application.

Note: The component requires the Visual C++ environment to be set up before it can be build.

The component can be run standalone by simply executing simpleapp.exe from the build directory.

e.g. C:\simpleMFCApp\simpleApp\build\simpleapp.exe


The above example does not use Capsules or any of the TargetRTS services. To use these within an MFC application, a separate thread should be used and the Rose RealTime model created as a library.

When viewing the model, users should also note the use of the "SimpleApp" C++ ImplementationPreface and PublicDeclarations. These are where the application's message map macro's and the application instance are created.

e.g. ImplementationPreface

BEGIN_MESSAGE_MAP(SimpleApp, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

SimpleApp theApp;


and PublicDeclarations

DECLARE_MESSAGE_MAP()


The resources used by the model can be found in the model directory structure.

Also in that directory is a header file "CWinApp.h" which has a single line "#include afxwin.h". The reason for this is because the "simpleApp" Class is derived from CWinApp. The way that RoseRT generates the code is by including the header file of the parent class. However for MFC, everything is defined in one header file "afxwin.h". So by adding the CWinApp.h, we ensure the definition for the parent is found.





simpleMFCApp.zip
[{"Product":{"code":"SSSHKL","label":"Rational Rose RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003.06.01","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

158644924

Document Information

More support for:
Rational Rose RealTime

Software version:
2003.06.01

Operating system(s):
Windows

Document number:
329085

Modified date:
16 June 2018

UID

swg21132533