BUG: ATL Connection Point Wizard Generated Code for Event with VARIANT Argument Gives C4305 Warning (250847)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- The Microsoft Active Template Library (ATL) 3.0
This article was previously published under Q250847 SYMPTOMS
The ATL Connection Point wizard generates a proxy class that implements a connection point for an out going interface. If an out going interface has an event that takes an argument of type VARIANT, then the wizard generates the wrong code in the out going call (Fire method) for that event. The Visual C++ compiler gives these two warnings when you call this fire method in your code
warning C4305: 'argument' : truncation from 'struct tagVARIANT *' to 'bool'
warning C4800: 'struct tagVARIANT *' : forcing value to bool 'true' or 'false' (performance warning)
CAUSE
Implementing the Connection Point wizard generates the wrong code in the Fire_ method for the event that takes VARIANT as parameter. For Event1, with VARIANT parameter Param1, it generates this code
pVars[0] = &Param1;
instead of this
pVars[0] = Param1;
in Fire_Event1 method of the proxy class.
RESOLUTION
To work around this problem manually remove the "&" before the Param1.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 12/11/2003 |
---|
Keywords: | kbBug kbConnPts kbpending KB250847 kbAudDeveloper |
---|
|