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);
    }
  • 相关阅读:
    failonerror on MSBuild
    近期Windows Mobile问题汇总
    android的文件操作 sdcard和rom
    用实际库存数调整批次保留最新的批次
    各种布局layout
    javascript让ui线程让出时间片的模型
    android ListView控件操作绑定数据、单击事件
    Pocket PC 模拟器上网设置
    android单元测试
    打电话发短信
  • 原文地址:https://www.cnblogs.com/whzym111/p/6226487.html
Copyright © 2011-2022 走看看