To use FlowChartX in Visual C++ version 6.0 follow these steps:
The wizard generates C++ wrapper classes for the objects from FlowChartX type library and an item for the control is added to "Controls toolbox". Now you can start using the control.
Note |
---|
In Visual C++ 7.0 there is a problem importing ActiveX controls in general and FlowChartX particularly: unlike version 6 importing the control through MFC wizard will not generate wrapper classes for the whole FlowChartX object hierarchy. If you use the "Add class from ActiveX control" wizard it will generate a class just for the FlowChart object, but not for Box, Arrow, Boxes and Arrows collections. Respectively "Add class from Type Library" wizard generates a class for all FlowChartX objects but with faults - FlowChartX properties and methods' parameters that are object references are declared as LPDISPATCH instead of CBoxItem, CArrowItem, CBoxes or CArrows as in Visual C++ 6.0. |
In order to help you workaround these problems we have included in FlowChartX installation the control wrapper classes as generated by Visual C++ 6. You can find them in "MFC wrapper" subfolder in your root installation folder. Following steps describe how to use them in Visual C++ 7.0 projects:
You can also use these files in Visual C++ 6.0, since we have manually added the enumeration constants. SetPolyShape is fixed too because it was not correctly imported by Visual C++ 6.0 due to parameter type conversion error.
Remember to pay special attention to event handling in all Visual C++ versions. Event methods that receive as parameter reference to a box, table or arrow object should not change its reference count. Still the COleDispatchDriver-derived wrapper classes by default call the attached COM object Release function in their destructor, which decreases the reference count. As a result the count might go to zero and the item be destroyed unexpectedly. To avoid this, either set the wrapper object m_bAutoRelease member to FALSE, or call Detach method before the object goes out of scope:
C++ Copy Code |
---|
void App::OnTableCreated(LPDISPATCH pTableItem) |
All Request* validation events have a VARIANT_BOOL output pointer argument, but the event wizard erroneously declares that argument as a pointer to BOOL. Size of the VARIANT_BOOL type is 2 bytes, and that of BOOL is 4 bytes. Assigning a BOOL TRUE or FALSE constant value directly to the output argument would cause a big mess in the stack, potentially overwriting the method return address or local variables of other methods. To work-around that, cast the argument to VARIANT_BOOL pointer and assign VARIANT_TRUE or VARIANT_FALSE values as shown below:
C++ Copy Code |
---|
void CTreeLayoutDlg::RequestSelectArrow(LPDISPATCH arrow, BOOL* pbSelect) |