也可以模拟 Internet 协议的IP格式由四个三位数字段组成,每个字段单独处理。
实际应用中通常是用 in_addr 结构表示IP地址。
in_addr结构简单可以这样理解:
struct in_addr {
u_char s_b1;
u_char s_b2;
u_char s_b3;
u_char s_b4;
};
程序代码:
实际应用中通常是用 in_addr 结构表示IP地址。
in_addr结构简单可以这样理解:
struct in_addr {
u_char s_b1;
u_char s_b2;
u_char s_b3;
u_char s_b4;
};

of=CREATEOBJECT("form1") of.show(1) DEFINE CLASS form1 as Form ADD OBJECT label1 as label WITH left=10,top=10,width=135,height=16,backcolor=0x00FFFFFF,; BorderStyle=1,caption=" . . . " ADD OBJECT ip1 as text_ip WITH left=11,top=11,width=30,height=14 ADD OBJECT ip2 as text_ip WITH left=42,top=11,width=30,height=14 ADD OBJECT ip3 as text_ip WITH left=78,top=11,width=30,height=14 ADD OBJECT ip4 as text_ip WITH left=114,top=11,width=30,height=14 ENDDEFINE DEFINE CLASS text_ip as TextBox Alignment = 2 BorderStyle = 0 Margin = 0 Format = "Z" InputMask = "999" value = 0 PROCEDURE valid RETURN BETWEEN(this.Value,0,255) ENDPROC ENDDEFINE