tags:

views:

79

answers:

0

hi,

I'm trying to pass a UDT as a parameter to a ATL event.

IProxy_MyInterface::OnMyATLEvent ([in] MyUDT* pVal);

I used the ATL wizard for generating code for the Event. However, in the generated code, the "pVal" is simply assign to a CComVariant. Also, when I compile the code, it shows a warning

: warning C4800: 'MyUDT *' : forcing value to bool 'true' or 'false' (performance warning)

Please help me to resolve this problem.

Thank you

EDIT

Here is the struct definition.

typedef
[ 
    uuid(1801AD39-C98B-4dae-989B-DEC50A9556D8), 
    helpstring("MyUDT")
]
 struct MyUDT{      

    BSTR     bstr_Val1;
    BSTR     bstr_Val2;

} MyUDT;

This is the first entry of my IDL

NOTE : I found that there is a bug with generate ATL code for event with UDT, Please Refer http://www.codeproject.com/KB/atl/udtdemo.aspx?msg=3069284 Section "Safe Arrays" in EVENTS.

In the article, it explains passing array of UDT, but I need to pass only one UDT refrence.

RESOLVED

Please refer the comment section in the provided link above