CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  控件

.ini 中的信息怎么才能让控件上面得到显示

楼主sunjun81(巧蕾)2001-04-17 13:09:00 在 VB / 控件 提问

  我有一个commad控件数组和一个.ini   文件   我希望command   控件上面(比如caption等等)能够得到我.ini   文件上面得到信息.并且可以执行.ini   文件中这些command   控件相对应的.exe   请问用vb   如何完成thanks  
  my   email:sunjun812163.net   (   最好有方法或原代码) 问题点数:25、回复次数:2Top

1 楼Richard2001(Richard)回复于 2001-04-17 13:27:00 得分 0

用API函数GetPrivateProfileString()获取.ini文件中的信息进行处理,用  
      Shell()   函数执行.exe文件。  
  Top

2 楼T2(無藥可救)回复于 2001-04-17 13:39:00 得分 25

Public   Declare   Function   GetPrivateProfileString   Lib   "kernel32"   Alias   "GetPrivateProfileStringA"   (ByVal   lpApplicationName   As   String,   ByVal   lpKeyName   As   Any,   ByVal   lpDefault   As   String,   ByVal   lpReturnedString   As   String,   ByVal   nSize   As   Long,   ByVal   lpFileName   As   String)   As   Long  
   
  Public   Declare   Function   WritePrivateProfileString   Lib   "kernel32"   Alias   "WritePrivateProfileStringA"   (ByVal   lpApplicationName   As   String,   ByVal   lpKeyName   As   Any,   ByVal   lpString   As   Any,   ByVal   lpFileName   As   String)   As   Long  
   
  Public   Function   g_GetIniString(ByVal   f_strKey   As   String,   _  
                                                ByVal   f_strSubKey   As   String,   _  
                                                ByVal   f_strIniFileName   As   String)   As   String  
   
  On   Error   GoTo   ErrExit  
           
          Dim   strTemp   As   String   *   144  
          Dim   nRetCode   As   Long  
          Dim   strWinDir   As   String  
   
          'the   following   series   of   the   API   function   call   "GetPrivateProfileString"  
          'retrieves   info   from   the   user's   .ini   file   ---this   file   originally  
          'had   its   values   set   by   the   setup   program   for   that   module  
          nRetCode   =   GetPrivateProfileString(f_strKey,   f_strSubKey,   Space(144),   strTemp,   144,   f_strIniFileName)  
          g_GetIniString   =   Left(strTemp,   InStr(strTemp,   Chr$(0))   -   1)  
   
  ErrExit:  
   
  End   Function  
   
  Public   Function   g_WriteIniString(ByVal   f_strKey   As   String,   ByVal   f_strSubKey   As   String,   _  
                                                  ByVal   f_strValue   As   Variant,   ByVal   f_strIniFile   As   String)   As   String  
                                                   
  On   Error   GoTo   ErrExit  
   
          Dim   i   As   Integer  
          Dim   strTemp   As   String  
          Dim   n   As   Long  
           
          strTemp   =   f_strValue  
           
          For   i   =   1   To   Len(f_strValue)   Step   1  
                  If   Mid$(f_strValue,   i,   1)   =   vbCr   Or   Mid$(f_strValue,   i,   1)   =   vbLf   Then   Mid$(f_strValue,   i)   =   ""  
           
          Next  
           
          n   =   WritePrivateProfileString(f_strKey,   f_strSubKey,   strTemp,   f_strIniFile)  
   
  ErrExit:  
            g_WriteIniString   =   Err.Description  
  End   Function  
  Top

相关问题

  • 需要注册什么ocx或dll才能显示flexgrid控件?
  • List Box 控件如何才能显示左右滚动条?
  • List Box 控件如何才能显示左右滚动条?
  • Repeater控件怎样才能显示如下效果
  • 怎么才能在VC中显示控件板啊???
  • 怎样才能让图象按原来比例显示在Image控件中?
  • mschart控件的饼图,如何才能显示百分比标签?
  • 用什么方法才能使File控件只显示出"*.txt"文件?
  • CTreeCtrl 在view里怎样才能显示出连线,不是在控件中
  • 怎样才能将日期控件中读取的值显示到文本框?

关键词

  • 控件
  • 文件
  • 信息
  • byval
  • ini
  • getprivateprofilestring
  • 得到
  • dim
  • function

得分解答快速导航

  • 帖主:sunjun81
  • T2

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo