MORE INFORMATION
Use the ATL Object Wizard to Create ATL Objects
Last-minute testing revealed that the ATL ClassWizard can reset properties
while editing interfaces and that the ATL ClassWizard allows users to
create different interfaces with the same name. This is a known problem and
Microsoft is working on it.
Workaround
Once you have used the ATL Com AppWizard, use the ATL Object Wizard to
create new ATL objects.
To Access the ATL Object Wizard:
- Right-click your project's classes in ClassView to display the shortcut
menu.
- Click the New ATL Object command.
- In the left pane of the ATL Object Wizard dialog box, click Objects.
- Click the Simple Object icon.
- Click Next.
- Use the resulting ATL Object Wizard Properties dialog box to define
your ATL object.
ATL Proxy Generator May Not Properly Destroy VARIANTARGs
If you have used the multicast component of the ATL Proxy Generator to
generate ConnectionPoint broadcast code, (code that calls all active
connections on a connection point), then one or more of the generated
functions employs zero or more VARIANTARGs that are local to each function.
(VARIANTARG is typed as VARIANT using typedef in oaidl.h.) Correct use of
VARIANT includes a VariantInit call on the VARIANT before its use and
VariantClear afterward. (VariantInit sets a VARIANTARG to a known empty
state, VariantClear sets it back to a known state and frees all memory used
by the VARIANTARG.) The multicast component calls VariantInit for each
VARIANTARG but does not call VariantClear. In some cases, this may result
in memory leaks.
Workaround
Manually add call(s) to VariantClear to the code that is generated by the
multicast component. An alternative is to change all uses of VARIANTARG to
CComVariant and remove the calls to VariantInit because CComVariant calls
VariantInit in the constructor and VariantClear in the destructor.
Two New Template Variables Available to Custom AppWizards
root_oem Same as 'root' except translated to the OEM character set.
Affects only upper ASCII characters in the project name
(such as an umlauted character).
HM_FILE_OEM Same as 'HM_FILE' except translated to the OEM character
set. Affects only upper ASCII characters in the project name
(such as an umlauted character).
The Visual C++ tools work with the ANSI character set. Batch files, such as
makehelp.bat, work with the OEM character set--a legacy from the days of
DOS 1.0 that still exists. Most printable characters in these two sets are
the same. However, there are some differences in some of the upper ASCII
values used for European characters such as those that use an umlaut.
Problems with ClassWizard-Generated Wrapper Classes for Visual Basic 5
ActiveX Servers
With Visual Basic 5.0 you can create ActiveX Automation servers with
methods that can take Optional and Default parameters of any Visual Basic
intrinsic type. If you use MFC and want to access an object of a Visual
Basic ActiveX Automation server, you would, typically, use ClassWizard to
read the type information of the Visual Basic object and generate a class
that wraps the functionality of the Visual Basic Automation object. C++
does not have optional or default parameters and so the wrapper class that
ClassWizard generates will not mark parameters as Optional or Default.
For example, if you have a Visual Basic Server with the following function:
Function function2(Optional parm1 As Integer = 5)
MsgBox parm1
End Function
ClassWizard will generate the following C++ wrapper function:
VARIANT _MyVBObj::function2(short* parm1)
{
VARIANT result;
static BYTE parms[] = VTS_PI2;
InvokeHelper(0x60030001, DISPATCH_METHOD, VT_VARIANT,
(void*)&result, parms, parm1);
return result;
}
If you call the ClassWizard generated function from your MFC program, you
will have to pass the argument even though Visual Basic marked it as
Optional.
Workaround
Override the function that ClassWizard generates with versions of the
function that take only the parameters you wish to pass. For example, in
the preceding case, if you didn't want to pass the optional parameter,
override the ClassWizard generated function as follows:
VARIANT _MyVBObj::function2()
{
VARIANT result;
InvokeHelper(0x60030001, DISPATCH_METHOD, VT_VARIANT,
(void*)&result, NULL);
return result;
}
In the preceding case, the default parameter for the Visual Basic server's
function2 would be used.
Newly Added Classes May Not be Displayed in the ClassView
Dependency scanning in Visual C++ 5.0 has changed from earlier versions of
Visual C++. Only files that are in the project will be scanned by
ClassView. The External Dependency folder is automatically populated by the
IDE and is not considered part of your project. If you want to see classes
from header files that are in the External Dependencies folder, insert that
file into your project. One easy way to insert a file from the External
Dependencies folder is by dragging and dropping it into the project.
ATL Controls in Visual Basic 5.0 Containers
If you're using the IQuickActivate interface in Visual Basic 5.0, you must
also support IPropertyNotifySink.
To use a control generated by the ATL Object Wizard in a Visual Basic 5.0
container, you must either add support for IPropertyNotifySink or remove
dependence on the IQuickActivate interface. To remove IQuickActivate
support, comment out the lines containing IQuickActivateImpl in the
control's class inheritance list and in the COM interface map.
For example, if you generate a Full Control called MyCtl with the ATL
Object Wizard, then go to MyCtl.h and comment out the line containing
IQuickActivateImpl in the CMyCtl class inheritance list:
class ATL_NO_VTABLE CMyCtl :
...
// public IQuickActivateImpl<CMyCtl>
Also, comment out the line containing IQuickActivateImpl in the COM
interface map in MyCtl.h:
<WWFIXEDTEXT><![CDATA[
BEGIN_COM_MAP(CMyCtl)
...
// COM_INTERFACE_ENTRY_IMPL(IQuickActivate)
Development Environment is Unresponsive While Processing a VBScript Macro
The Visual C++ user interface does not respond to mouse clicks or
keystrokes until a macro finishes. Processing a lengthy macro gives the
appearance that the user interface has hung. This design prevents
indiscriminate interference between macros.
Add Microsoft Transaction Server Libraries to Your Proxy/Stub Makefile
If you are using a separate Proxy/Stub DLL created with the ATL COM Wizard,
add the library mtxih.lib as the first library on the link line.
ClassView's Add Method and Add Property Dialogs Sometimes Allow Illegal
Return Types for Custom Interfaces
The return type dropdown for Add Method and Add Property should be active
only for dispinterfaces and for custom interfaces with the attribute
'local'. The return type is fixed at HRESULT for all other interface
definitions--such as dual. Unfortunately, it is active for all non-dual
interfaces. The midl compiler will fail with error 2269 when you build your
project if you change the return type to something other than HRESULT or
SCODE for a property or method in a custom interface that doesn't have the
'local' attribute.