Visual C++ MFC
Class Wizard.
1
Even the most committed
VC++
developer
can get frustrated with the logistics of keeping C++ header and source
files synchronized, particularly when a large refactoring exercise needs
to be completed. On top of the tedious nature of changing method
signatures, achieving the correct syntax for handling
MFC commands
and Windows messages is a tucancode.net that can be better achieved by an IDE
tool rather than a developer toiling away in a text editor. Classic
versions of Visual C++
(where 'classic' is defined as Visual C++
versions that existed as an independent IDE rather than integrated in
Microsoft Visual Studio
had an elegant tool that addressed this problem, and the long-promised
return of the Class Wizard
is achieved in Visual C++
2017.
Highlighting its
specific-Visual C++ nature, the
Class Wizard is launched from the
Project IDE menu rather than the view menu where many of the other code
navigation windows are launched. The Class
Wizard is divided into five tabs, with the first two
specifically designed to make working with
MFC
commands and Windows messages simpler. All tabs share a common
header control that allows the project and class that the Class Wizard
is displaying to be selected, with the Base Class, Resource name, header
file and implementation file of the selected class all displayed.
First time here?
|
Product
Tour
E-XD++ Workflow Component product walkthrough
Screenshots
Applications built on E-XD++ Workflow Component
Product
feature comparison
Powerful, flexible, and
easy to use Diagram Components.
Powerful and flexible enough to create diagrams exactly the way you want
them to appear. So easy to use that you will be able to prototype your
application in just a few minutes.
Feature rich.
With features such as automatic layout, multiple layers, collapsible
sub-graphs, snap-to connection points, XML, SVG, and more, E-XD++ Have the
power and flexibility you need to create sophisticated diagrams, quickly and
easily. Events such as click, double-click, hover, select, rubber-band
select, copy, delete, resize and move are supported. Operations such as
drag-and-drop, unlimited undo/redo, and clipboard operations are common and
complex, and are expected by today's sophisticated users. it full supports
importing ArcGis, SVG and DXF File format.
Performance and
Scalability.
UCanCode E-XD++ Capable of handling many thousands of nodes and edges, up to
hundreds of thousands depending upon the complexity of the nodes you wish to
draw and the operations you wish to allow. Our graphical classes are
extremely lightweight objects enabling outstanding performance.
Save Time and Money and gain Reliability.
A diagram is worth 1,000 words, and E-XD++ is shipped with more than 500,000 lines of well designed and well tested code! It is used by hundreds of the world's most quality conscious companies. It will saves you thousands of hours of complex coding and years of maintenance.
The leader
in visualization component -- FULL VC++ Source Code Shipped!
XD++ Diagrammer Suite is the the world’s
leading VC++ and .NET visualization component. Renowned for incredibly rich
graphics, XD++ helps thousands developers build applications that offer
unparalleled functionality. Outstanding productivity lowers project risk and
reduces maintenance headaches. With 20 years of dedicated research and
development, UCanCode leads the market for visualization technologies,
providing outstanding customer support. |
Figure 1. Visual C++ Class Wizard -
MFC Command Tab
The
MFC Command Tab, shown in Figure 1,
allows for the easy addition, deletion and code management of handlers
for MFC Commands. For those with a
scratchy memory on the differences between MFC
commands and Windows messages, it's worth a brief discussion on what
each represents. MFC commands derive
from the special Windows message
WM_COMMAND
which is used to notify the application that a command has been executed
by the user, such as when a menu item has been selected.
MFC uses a macro-based message map
to convert these commands to specific functions, and any
MFC class that is derived
from CWnd can have its own message map. Commands are high-level, and map
multiple physical actions like Ctrl-C and Edit | Copy to the same
command. On top of the main
ON_COMMAND macro,
MFC also supports a
ON_UPDATE_COMMAND_UI
macro which is used to query the application about the display state of
a menu item, such as whether it should be disabled or appear.
BEGIN_MESSAGE_MAP(CClassView, CDockablePane)
ON_COMMAND(ID_CLASS_ADD_MEMBER_FUNCTION, OnClassAddMemberFunction)
ON_COMMAND(ID_CLASS_ADD_MEMBER_VARIABLE, OnClassAddMemberVariable)
ON_COMMAND(ID_CLASS_DEFINITION, OnClassDefinition)
ON_COMMAND(ID_CLASS_PROPERTIES, OnClassProperties)
ON_COMMAND(ID_NEW_FOLDER, OnNewFolder)
ON_COMMAND_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS,
OnSort)
ON_UPDATE_COMMAND_UI_RANGE(ID_SORTING_GROUPBYTYPE,
ID_SORTING_SORTBYACCESS, OnUpdateSort)
END_MESSAGE_MAP()
By using the Class Wizard,
these message map entries and the associated class
methods can be located, added to and deleted, saving
a great deal of time manually adding the required
entries and debugging commands that are mysteriously
left unfired.
In contrast to the
narrow range of MFC commands,
Windows messages encompass a much wider range of event notifications,
such as window creation and destruction, events related to power
management in Windows and changes of screen resolution and orientation.
Figure 2 shows the Message tab of the Class
Wizard.
Figure 2. Class Wizard - Message Tab
In addition to the
features that are present on the MFC
command tab, the Message tab allows custom messages to be handled via
the pop-up dialog shown in Figure 3.
Figure 3. Handling Custom Message
For the message shown
in the dialog, the definition of the custom message in the form #define
WM_MY_MESSAGE WM_USER + 0 must be available to the source file
containing the message handler. Windows message handlers are included in
the message map using either the
ON_MESSAGE
or ON_REGISTERED_MESSAGE
macros:
#define WM_MY_MESSAGE
WM_USER + 0
static UINT WM_MY_CUSTOM_REGISTERED_MESSAGE =
RegisterWindowMessage(_T("MY_CUSTOM_MESSAGE"));
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
ON_MESSAGE(WM_GESTURE, &CAboutDlg::OnGesture)
ON_WM_ACTIVATE()
ON_MESSAGE(WM_MY_MESSAGE, &CAboutDlg::OnMyMessage)
ON_REGISTERED_MESSAGE(WM_MY_CUSTOM_REGISTERED_MESSAGE,
&CAboutDlg::OnMyCustomRegisteredMessage)
END_MESSAGE_MAP()
MFC
provides pre-defined message handlers like
ON_WM_ACTIVATE
that are mapped to pre-defined functions like
CWnd::OnActivate .
For standard Windows messages that are not present
in the Class Wizard
listbox, the Add Custom Message dialog can be used
to map a member function. In the message map above,
the
WM_GESTURE
message, which is used to provide touch-based
gesture support in Windows 7 and above, has been
mapped.
In contrast to the
first two tabs of the Class Wizard
that are specifically designed to provide support for
MFC
Windows applications, the last three tabs of the
Class Wizard that deal with Virtual
Functions, Member Variables and Methods can be effectively used with any
type of VC++
application. The Virtual Function tab, shown in Figure 4, is
extremely useful when dealing with classes derived from a deep and rich
framework like MFC. For classes
derived from CWnd
and CDoc ,
there are literally dozens of virtual functions in base classes that can
be derived from in order to customize certain behavior, and locating
these function and providing the appropriate method signature can be a
tedious exercise of copy-and-pasting from documentation or header files.
The Class Wizard greatly simplifies
this tucancode.net.
Figure 4. Class Wizard - Virtual
Functions
The final two tabs
which display Member Variables and Virtual Functions, which are shown in
Figures 5 and 6 respectively, focus more on managing the
class selected in the drop-down in
the Class Wizard header. The Member Variable tab allows either a
standard member variable to be added via the Add Custom selection, or
for the addition of a variable that maps to a
MFC
controls and hooks into the DDX data exchange between control
and variables. With the Methods tab, methods can be added and deleted
from a class, and support exists to navigate to either the declaration
or definition of any existing method.
Figure 5. Class Wizard - Member
Variables
Figure 6. Class Wizard - Methods
UCanCode Conclusion
The integration of
Visual C++ inside the main Visual
Studio IDE and the focus on managed development that accompanied the
.NET release caused some regression in the features available to a
C++ developer.
With Visual C++ 2008 and 2010, this
regression has been thoroughly addressed, and
Visual C++ 2010 is a product
that can comfortably compete with Visual C++
6 on an age-adjusted scale. The Class Wizard
was an important tool for many C++ developers, especially for the
production of MFC
GUI applications where a lot of the manual work of command and
message mapping could be easily managed, and the return of this tool
will give many long-suffering Visual C++ developers yet another reason
to consider retiring the 'suffering' tag and enjoy
Visual C++ development again.
More visit:
http://www.ucancode.net
Contact UCanCode Software
To buy the source code or learn more about with:
|
|