CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    13

    warning when passing structure as [out] paramter of an interface

    I tried passing the structure given below

    typedef struct _dcmureturn
    {
    INT m_CCRactivestep;
    INT m_numburntlamps;
    INT m_CCRshudowncause;
    BOOL m_CCRpowerloss;
    BOOL m_CCR_VA_drop_tenpc;
    BOOL m_CCRfail_comanded_op_current;
    BOOL m_CCR_status;
    ULONG m_CCR_rms_op_current;
    ULONG m_CCR_rms_op_voltage;

    }DCMURETURN;

    as [out] parameter in my interface shown below {from .idl file}

    ***************************************************************************

    interface Iccr : IDispatch
    {
    [id(1), helpstring("method switchon")] HRESULT switchon([in] BSTR cricuitID, [in] INT step, [in] INT spare);
    [id(2), helpstring("method getstatus")] HRESULT getstatus([in] BSTR circuitID, [out] DCMURETURN* pdcmuret);
    };


    *****************************************************************************

    I get the following warning during compilation


    "warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'pdcmuret' of Procedure 'getstatus' ( Interface 'Iccr' ) ]"



    The DCMURETURN structure is declared in the same .idl file.



    I also get two other warnings

    (1) warning C4244: '=' : conversion from 'const double' to 'unsigned long', possible loss of data

    (2) : warning C4244: '=' : conversion from 'const double' to 'unsigned long', possible loss of data



    I urgently require help on this. If you can help please do.

    NOTE: I am new to COM/DCOM


  2. #2
    Join Date
    May 1999
    Location
    Indiana
    Posts
    21

    Re: warning when passing structure as [out] paramter of an interface

    Automation interfaces derive from IUnknown or IDispatch, have a return of HRESULT or SCODE, and have parameters that are automation compatible. A dual interface is implicitly an automation interface. If it is not a dual interface, you include the oleautomation attribute on the interface.

    If you want your interface to remain a dual you will need to change the structure to an automation compatible parameter. You could load your structure into a SafeArray of Bytes.

    You could also make this a custom interface that is not an automation interface (remove dual attribute, inherit from IUnknown, and change the CoClass definition/COM MAP).

    The automation compatible parameters are boolean, unsign char, Double, Float, Int, Long, Short, BSTR, CY, Date, SCODE, Enum, IDispatch*, or IUnknown*. The parameter can also be a pointer to one of these types or a SafeArray of one of these types.


  3. #3
    Join Date
    Apr 1999
    Posts
    37

    Re: warning when passing structure as [out] paramter of an interface

    Hi,
    The warning tells u that u are using a parameter type(DCMURETURN) which is not comaptible with ole automation.youmust have specified the oleautomation attribute to that interface so it expects all parameters and return type to fall within the category of ole automation compatible types.here is the list of automation comaptible datatypes

    boolean
    unsigned char
    Double
    Float
    BSTR
    CY
    Int
    Long
    Short
    DATE
    SCODE
    Enum
    IDispatch *
    IUnknown *

    U can afford to ignore the warning if ur COM server is in-proc.MIDL warns u that u wont get the support of the standard OLE automation's marshaler for the method getstatus because the universal marshaller doesntrecognize ur structure DCMURETURN.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured