struct CPingReply
{
in_addr Address; //The IP address of the replier
unsigned long RTT; //Round Trip time in Milliseconds
int Seq; //Sequence number
inline CString GetIP(){
CString str;
str.Format("%d.%d.%d.%d",Address.S_un.S_un_b.s_b1,Address.S_un.S_un_b.s_b2,
 Address.S_un.S_un_b.s_b3,Address.S_un.S_un_b.s_b4);
return str;
}
};

解决方案 »

  1.   

    一样定义了,只是ATL中好像没有CString,你可以用basic_string<TCHAR>替代
      

  2.   

    小弟刚开始弄这方面的定义,如果这个结构体用于返回,需要在什么地方定义?(支持MFC的开发中)
      

  3.   

    //从你的另一个帖子copy过来的自定义结构必须声明在idl中,如果是用vc7属性化编程的话必须声明在接口声明的.h头文件的include下面而且还要加上一个导出属性[export]
    eg:
    vc6中在idl:
    typedef struct Point
    {
       double x;
       double y;
    };    //用向导给接口加方法或者属性时手动填写参数类型
    vc7中在.h:
    [export]
    struct Point
    {
       double x;
       double y;
    };  //用法相同
    提示:如果你在方法中没有用到这个自定义结构作参数那么客户端是看不到这个结构的!
      

  4.   

    vc6中在idl:
    typedef struct Point
    {
       double x;
       double y;
    };    //用向导给接口加方法或者属性时手动填写参数类型我在idl 中试过了,有一错误提示。syntax error : expecting a type specification near CMyStruct
      

  5.   

    其中 CMyStruct 的结构为.
    struct CPingReply
    {
    in_addr Address; //The IP address of the replier
    unsigned long RTT; //Round Trip time in Milliseconds
    int Seq; //Sequence number};
      

  6.   

    原因是idl中无法识别你的类型in_addr,不要用in_addr类型,找一个替代类型,或者自己定义,idl只支持一些基本类型,不知道那位高人还有更好的办法