[uuid(6A8EBB1A-57ED-48f4-BE7B-AE74C5206D5A)] typedef struct tag_Record{
  short grade;
} Record;这样? 也不行啊
E:\Works\BT\V1\client\test\2\2.idl(60) : warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'psa' of Procedure 'CreateRecord' ( Interface 'ICreator' ) ]
midl\oleaut32.dll : warning MIDL2368 : error generating type library, ignored : Could not set UUID : tag_Record

解决方案 »

  1.   

    在IDL文件中定义你的结构体
       typedef 
        [ 
            uuid(AB5526D5-736A-4a3e-BB87-35450C1FC7DF), 
            version(1.0),        helpstring("存储组信息的数据结构")
        ]
    struct
    {
    CHAR szGroupName[MAX_NAME_LEN];
    CHAR szGroupComment[MAX_COMMENT_LEN];
    CHAR szCreatorID[MAX_ID_LEN];
    CHAR szCreateTime[MAX_FULL_TIME_LEN];
    CHAR szChangeID[MAX_ID_LEN];
    CHAR szChangeTime[MAX_FULL_TIME_LEN];
    INT  nGroupNo;
    }GroupInfo;如果接口在编译时出现warning ,则不必理会,因为这是编译器的bug
      

  2.   

    可以分成两种情况来考虑
    1。你传的东西不夸进程,这就好办了,你随便传什么东西都可以,就算你传void * 指针也无所谓,传自己写的COM对象指针也不用考虑太多,能编译过去就OK,怎么骗过midl编译器上面有人说了,或者你看看现在挂的公告
    2.要传跨进程或机器,最好是把对象整个传过去,可以考虑支持IStream,用流整个打包传过去,修改完成后再整个传过来
      

  3.   

    to:  borz (习波)  
    最近比较忙、比较烦,每天上来一观,只要没人打广告没反动言论就撤了
    不过本版还比较好,没那么多无聊的人
      

  4.   

    感觉上面两位,我按 程序应笑我 的方法改了Idl,把该interface的定义放在library段中,如下
    [
    object,
    uuid(F2056B4F-3C63-43F8-AD3E-39DDD20D82BF),
    dual,
    helpstring("ICreator Interface"),
    pointer_default(unique)
    ]
    interface ICreator : IDispatch
    {
    typedef 

    uuid(AB5526D5-736A-4a3e-BB87-35450C1FC7DF), 
    version(1.0), helpstring("存储组信息的数据结构")
    ]
    struct
    {
    short shortval;
    }MyRecord;
    [id(2), helpstring("method GetRS")] HRESULT GetRS([in]BSTR query,[out]_Recordset **ppRs);
    [id(3), helpstring("method CreateRecord")] HRESULT CreateRecord([out,retval] MyRecord **r);
    [id(4), helpstring("method MsgBox")] HRESULT MsgBox();
    };编译果然又出现警告信息
    E:\Works\BT\V1\client\test\2\2.idl(110) : warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'r' of Procedure 'CreateRecord' ( Interface 'ICreator' ) ]
    midl\oleaut32.dll : warning MIDL2368 : error generating type library, ignored : Could not set UUID : __MIDL_ICreator_0001不管他了,在vb中写代码测试Private Sub Command1_Click()
        Set creator = CreateObject("Creator.Creator.1")
        creator.MsgBox
        creator.CreateRecord //3
    End Sub当程序运行到第三行时,出现vb runtime error 458
    Variable uses an Automation type not supported in VB如何是好?
      

  5.   

    小弟初识COM/ATL,我这里没有一本关于ATL的书,所有的一切资料均来源于MSDN 98,上面的大侠能否介绍我几本讲ATL的电子书,不甚感激,
    再则,我发现本论坛上很多人象我一样对Automation之流不能很好的理解,即使已有的结贴好象都不能切中要害(也许是我天天笨),希望大侠们能专门发一篇贴子,以自己的语言总结一下Automation,特别是自定义参数之类谢了
      

  6.   

    兄台,好像你的idl中并没有导入你的MyRecord定义啊,
    还有,你不是真的永了
    struct
    {
    CHAR szGroupName[MAX_NAME_LEN];
    CHAR szGroupComment[MAX_COMMENT_LEN];
    CHAR szCreatorID[MAX_ID_LEN];
    CHAR szCreateTime[MAX_FULL_TIME_LEN];
    CHAR szChangeID[MAX_ID_LEN];
    CHAR szChangeTime[MAX_FULL_TIME_LEN];
    INT  nGroupNo;
    }GroupInfo;
    这种定义吧你要1.手动写一个MyRecord的COM对象,在里面实现你要的属性
    2.在要传递MyRecord指针的IDL中导入MyRecord的IDL定义我竟然看到在IDL中有用CHAR的,赫赫,真的出了一身汗
      

  7.   

    再给你个例子吧,这是我写的
    FAINT,为了20分这么费劲,强烈要求加到2000分:)
    有些废话,无关大局,注意偶就能在DRClient中使用CommArea指针做参数
    注意此方法只能在同一个进程中用,因为我传的是指针
    还有注意如果不在同一IDL中的话,看公告上的那个recordset如何导入的
    import "oaidl.idl";
    import "ocidl.idl";
    [
    object,
    uuid(C5C91DEF-91B0-494B-9B4F-E4EC385FFA7D),
    dual,
    helpstring("ICommArea Interface"),
    pointer_default(unique)
    ]
    interface ICommArea : IDispatch
    {
    [id(1), helpstring("method SetValue")] HRESULT SetValue([in]BSTR Key,[in]BSTR Value);
    [id(2), helpstring("method GetValue")] HRESULT GetValue([in]BSTR Key,[out,retval]BSTR * Value);
    [id(3), helpstring("method DelValue")] HRESULT DelValue([in]BSTR Key);
    [id(4), helpstring("method SetCommArea")] HRESULT SetCommArea([in]BSTR AreaString);
    [id(5), helpstring("method GetAreaString")] HRESULT GetAreaString([out,retval]BSTR * AreaString);
    [id(6), helpstring("method BeginWrite")] HRESULT BeginWrite();
    [id(7), helpstring("method BeginRead")] HRESULT BeginRead();
    [id(8), helpstring("method GetCommLen")] HRESULT GetCommLen([out,retval]long * Len); };
    [
    object,
    uuid(41E61164-94DA-4909-B512-073457937EFE),
    dual,
    helpstring("IDRClient Interface"),
    pointer_default(unique)
    ]
    interface IDRClient : IDispatch
    {
    [propget, id(1), helpstring("property ServiceID")] HRESULT ServiceID([out, retval] BSTR *pVal);
    [propput, id(1), helpstring("property ServiceID")] HRESULT ServiceID([in] BSTR newVal);
    [id(2), helpstring("method CallDRServer")] HRESULT CallDRServer([in,out]ICommArea **Area,[out,retval]long *nRet);
    [id(3), helpstring("method ClearSession")] HRESULT ClearSession();
    [id(4), helpstring("method EditConfig")] HRESULT EditConfig([out,retval]VARIANT_BOOL *bRet);
    [id(5), helpstring("method GetAllServiceName")] HRESULT GetAllServiceName([in]ICommArea *pArea,[out,retval]VARIANT_BOOL *bRet); };[
    uuid(474B6631-4682-46BB-A5EB-A9E0D9B0D71D),
    version(1.0),
    helpstring("DRClientLib2 1.0 Type Library")
    ]
    library DRCLIENTLIB2Lib
    {
    importlib("stdole32.tlb");
    importlib("stdole2.tlb"); [
    uuid(9E3A4B9D-6D0A-4AB6-9530-E5FAFCAB0D50),
    helpstring("CommArea Class")
    ]
    coclass CommArea
    {
    [default] interface ICommArea;
    };
    [
    uuid(EC64A45E-9D89-4219-A476-FCA94656CD57),
    helpstring("_IDRClientEvents Interface")
    ]
    dispinterface _IDRClientEvents
    {
    properties:
    methods:
    [id(1), helpstring("method OnCallServerStart")] HRESULT OnCallServerStart([in]BSTR ServerIP,[in]long ServerPort);
    [id(2), helpstring("method OnCallServerEnd")] HRESULT OnCallServerEnd([in]long Result,[in]BSTR RESPCODE,[in]BSTR DESCRIPT);
    }; [
    uuid(4E2BAECD-AB06-4D02-A16C-B680144E2D33),
    helpstring("DRClient Class")
    ]
    coclass DRClient
    {
    [default] interface IDRClient;
    [default, source] dispinterface _IDRClientEvents;
    };
    };
      

  8.   

    void write叉()
    {
    cout << '一撇' << '一点' <<endl;
    }
    void write爽()
    {
    cout << "写爽字" <<endl
    cout << '一横' << '一撇' << '一捺' <<endl;
            for(int i=0;i<4;i++)
    {
    write叉();
    }
    }
    void run()
    {
    while(1,write爽()){;}
    }void main()
    {
       run();
    }
    感谢感谢,,,加分了小弟的qq是 57226475,大侠如果不嫌弃的话,就把我加为好友吧
      

  9.   

    我也遇到这样的问题,,HELP ME!