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);
    }
  • 相关阅读:
    SQL Server 数据类型映射 (ADO.NET)
    微软SQLHelper.cs类 中文版
    在WinForm中使用Web Service来实现软件自动升级
    Winform开发框架之通用自动更新模块(转)
    C# winform 最小化到电脑右下角
    3层数据访问架构(部分)
    Castle ActiveRecord学习实践
    .Net下的 ORM框架介紹
    配置企业库5.0管理
    一个简洁通用的调用DLL函数的帮助类
  • 原文地址:https://www.cnblogs.com/whzym111/p/6226487.html
Copyright © 2011-2022 走看看