zoukankan      html  css  js  c++  java
  • mfc CIPAddressCtrl控件

    知识点:
     CIPAddressCtrl 属性
     CIPAddressCtrl 成员函数
     成员函数代码测试
    
    一、CIPAddressCtrl Class Members
    IsBlank
    Determines if all fields in the IP Address Control are empty.
    ClearAddress
    Clears the contents of the IP Address Control.
    GetAddress
    Retrieves the address values for all four fields in the IP Address Control.
    SetAddress
    Sets the address values for all four fields in the IP Address Control.
    SetFieldFocus
    Sets the keyboard focus to the specified field in the IP Address Control.
    SetFieldRange
    Sets the range in the specified field in the IP Address Control.
    
    二、代码测试
    // CDialog_IPAdress 消息处理程序
    
    void CDialog_IPAdress::OnBnClickedButton1()
    {
        // TODO: 在此添加控件通知处理程序代码
        BOOL r=m_ip.IsBlank();
        TRACE("%d 
    ",r);
    }
    
    void CDialog_IPAdress::OnBnClickedButton3()
    {
        // TODO: 在此添加控件通知处理程序代码
        m_ip.ClearAddress();
    }
    
    void CDialog_IPAdress::OnBnClickedButton2()
    {
        // TODO: 在此添加控件通知处理程序代码
        BYTE i1,i2,i3,i4;
        DWORD d;
        BYTE* pd=(BYTE*)&d;
    //    m_ip.GetAddress(i1,i2,i3,i4);
        
    
        m_ip.GetAddress(d);
        i4=*pd++;
        i3=*pd++;
        i2=*pd++;
        i1=*pd;
        TRACE("i1=%d,i2=%d,i3=%d,i4=%d 
    ",i1,i2,i3,i4);
    }
    
    void CDialog_IPAdress::OnBnClickedButton4()
    {
        // TODO: 在此添加控件通知处理程序代码
        m_ip.SetAddress(192,168,0,1);
        //m_ip.SetAddress(0x11223344);
    }
    
    void CDialog_IPAdress::OnBnClickedButton5()
    {
        // TODO: 在此添加控件通知处理程序代码
        static int f=0;
         if (f>3)
         {
             f=0;
         }
        m_ip.SetFieldFocus(f++);
    }
    
    void CDialog_IPAdress::OnBnClickedButton6()
    {
        // TODO: 在此添加控件通知处理程序代码
        //192.168.0.1- 192.168.0.100
         
        m_ip.SetFieldRange(0,192,192);
        m_ip.SetFieldRange(1,168,168);
        m_ip.SetFieldRange(2,0,0);
        m_ip.SetFieldRange(3,1,100);
    }
  • 相关阅读:
    cookie和session
    memcached安全性 django使用memcached
    spring boot jar包做成linux服务,windows服务开机启动
    sqlserver暂时停用全部外键
    jsonobject 转对象失败。
    spring bean 通过 applicationcontext 获取不到
    java spring 线程中注入bean会失败。
    浏览器预检,后台响应(转载)
    amazon redshift sql 语法 和my sql的区别
    返回视图,页面不跳转,return ModelandView 页面不能正确跳转问题
  • 原文地址:https://www.cnblogs.com/whzym111/p/6226487.html
Copyright © 2011-2022 走看看