在窗体中有3个EDIT控件IDC_EDITHOSTNAME、IDC_EDITIPADDRESS、IDC_EDIT3,1个LISTBOX控件IDC_LISTBOX1,2个按钮IDC_INSERT、IDC_DELETE。在程序目录中有一config.ini文件,内容如下:
[PCList]
pc1=192.168.0.1
pc2=192.168.0.2
...想实现如下功能:
1、程序启动后,将config.ini文件中的键名(pc1、pc2...)依次显示在IDC_LISTBOX1中。
2、在IDC_EDITHOSTNAME中输入计算机名(如pc3),在IDC_EDITIPADDRESS中输入IP地址(如192.168.0.3),点击IDC_INSERT后将计算机名插入到IDC_LISTBOX1中,同时将pc3=192.168.0.3写入config.ini中。
3、点击IDC_DELETE后,删除IDC_LISTBOX1中的选中项,同时删除config.ini中的相关信息。
4、在IDC_LISTBOX1中单击某一项(计算机名)后,在IDC_EDIT3中显示该计算机对应的IP地址。上述功能不知道该怎么写代码,请高手指点!!!

解决方案 »

  1.   

    Registry Functions
    The following functions are used with the registry:   
     
    RegCloseKey  
    RegConnectRegistry  
    RegCreateKey  
    RegCreateKeyEx  
    RegDeleteKey  
    RegDeleteValue  
    RegEnumKey  
    RegEnumKeyEx  
    RegEnumValue  
    RegFlushKey  
    RegGetKeySecurity  
    RegLoadKey  
    RegNotifyChangeKeyValue  
    RegOpenKey  
    RegOpenKeyEx  
    RegQueryInfoKey  
    RegQueryMultipleValues  
    RegQueryValue  
    RegQueryValueEx  
    RegReplaceKey  
    RegRestoreKey  
    RegSaveKey  
    RegSetKeySecurity  
    RegSetValue  
    RegSetValueEx  
    RegUnLoadKey  
    Obsolete Functions
      
     
    GetPrivateProfileInt  
    GetPrivateProfileSection  
    GetPrivateProfileSectionNames  
    GetPrivateProfileString  
    GetPrivateProfileStruct  
    GetProfileInt  
    GetProfileSection  
    GetProfileString  
    WritePrivateProfileSection  
    WritePrivateProfileString  
    WritePrivateProfileStruct  
    WriteProfileSection  
    WriteProfileString  
     
      

  2.   

    这个程序很简单啊,只要掌握基本的ListBox的操作和读写ini文件的函数就可以了。ListBox的操作参考MSDN,读写ini文件可以用GetPrivateProfileString和WritePrivateProfileString.
      

  3.   

    GetPrivateProfileString和WritePrivateProfileString就可以实现了,,好好学一下吧
      

  4.   

    http://blog.csdn.net/lixiaosan/archive/2004/10/28/156609.aspx
      

  5.   

    GetPrivateProfileString和WritePrivateProfileString就可以实现了,,好好学一下吧
    说得对