资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

求助,请高手们帮帮忙

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

问题1:如何才能获得“系统文件件位置”  
  问题2:如何制作像QQ那样的按钮界面,不能传图:(

网友回答:

发表者:baoaya

1.使用GetWindowsDirectory   GetSystemDirectory                     windows   api

发表者:starsoulxp

第一个问题:  
  如何找出   Windows   目录的正确路径?-   -  
                                                                                 
   
   
  有时候我们在程序中必须用到   Windows   的目录,以存取   Windows   目录下的文件,照理说,这应该是最简单的功能,前提是每个人在   Setup   Windows   必须采用   Windows   的预设目录名称,也就是   C:\Windows,但是常常不是这样,有时候由於要使新旧版本共存,或者其他原因,有人会将   Windows   目录改成   c:\win95、c:\win98、Windows95   或   Windows98......  
   
  若是程序中必须用到   Windows   目录,要找到正确的路径,做法如下:  
   
  在声明区中加入以下声明:  
   
  Const   MAX_PATH   =   260  
   
  Private   Declare   Function   GetWindowsDirectory   Lib   "kernel32"   Alias   "GetWindowsDirectoryA"   (ByVal   lpBuffer   As   String,   ByVal   nSize   As   Long)   As   Long  
   
  Public   Function   GetWinPath()  
  Dim   strFolder   As   String  
  Dim   lngResult   As   Long  
  strFolder   =   String(MAX_PATH,   0)  
  lngResult   =   GetWindowsDirectory(strFolder,   MAX_PATH)  
  If   lngResult   <>   0   Then  
  GetWinPath   =   Left(strFolder,   InStr(strFolder,   Chr(0))   -   1)  
  Else  
  GetWinPath   =   ""  
  End   If  
  End   Function  
   
  在程序中使用方法如下:  
   
  Private   Sub   Command1_Click()  
  Call   MsgBox("您电脑中   Windows   目录的正确路径是:   "   &   GetWinPath,   vbInformation)  
  End   Sub  
   
 


 

 
热门推荐笔记本: IBM笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved