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;
}
};
{
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;
}
};
eg:
vc6中在idl:
typedef struct Point
{
double x;
double y;
}; //用向导给接口加方法或者属性时手动填写参数类型
vc7中在.h:
[export]
struct Point
{
double x;
double y;
}; //用法相同
提示:如果你在方法中没有用到这个自定义结构作参数那么客户端是看不到这个结构的!
typedef struct Point
{
double x;
double y;
}; //用向导给接口加方法或者属性时手动填写参数类型我在idl 中试过了,有一错误提示。syntax error : expecting a type specification near CMyStruct
struct CPingReply
{
in_addr Address; //The IP address of the replier
unsigned long RTT; //Round Trip time in Milliseconds
int Seq; //Sequence number};