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

如何在VC++程序中得到Windows的系统目录的路径?

楼主tangl_99(tangl_99)2001-01-03 22:04:00 在 VC/MFC / 基础类 提问

问题点数:20、回复次数:4Top

1 楼breath(跨马倚斜桥,满楼红袖招)回复于 2001-01-03 22:09:00 得分 20

终于让我等到了,我抢  
  GetSystemDirectoryTop

2 楼antwork(人活着总得有点精神)回复于 2001-01-03 22:11:00 得分 0

哈哈Top

3 楼witsoft2000(踏雪无痕)回复于 2001-01-03 22:18:00 得分 0

breath说得一点没错Top

4 楼Jans(网事如风)回复于 2001-01-03 22:21:00 得分 0

我重复一下:  
   
  UINT   GetWindowsDirectory(  
      LPTSTR   lpBuffer,     //   address   of   buffer   for   Windows   directory  
      UINT   uSize                 //   size   of   directory   buffer  
  );  
     
  Parameters  
  lpBuffer    
  Pointer   to   the   buffer   to   receive   the   null-terminated   string   containing   the   path.   This   path   does   not   end   with   a   backslash   unless   the   Windows   directory   is   the   root   directory.   For   example,   if   the   Windows   directory   is   named   WINDOWS   on   drive   C,   the   path   of   the   Windows   directory   retrieved   by   this   function   is   C:\WINDOWS.   If   the   system   was   installed   in   the   root   directory   of   drive   C,   the   path   retrieved   is   C:\.    
  uSize    
  Specifies   the   maximum   size,   in   characters,   of   the   buffer   specified   by   the   lpBuffer   parameter.   This   value   should   be   set   to   at   least   MAX_PATH   to   allow   sufficient   room   in   the   buffer   for   the   path.    
  Return   Values  
  If   the   function   succeeds,   the   return   value   is   the   length,   in   characters,   of   the   string   copied   to   the   buffer,   not   including   the   terminating   null   character.    
   
  If   the   length   is   greater   than   the   size   of   the   buffer,   the   return   value   is   the   size   of   the   buffer   required   to   hold   the   path.    
   
  If   the   function   fails,   the   return   value   is   zero.   To   get   extended   error   information,   callGetLastError.    
  The   GetSystemDirectory   function   retrieves   the   path   of   the   system   directory.   The   system   directory   contains   such   files   as   dynamic-link   libraries,   drivers,   and   font   files.    
   
  UINT   GetSystemDirectory(  
      LPTSTR   lpBuffer,     //   address   of   buffer   for   system   directory  
      UINT   uSize                 //   size   of   directory   buffer  
  );  
     
  Parameters  
  lpBuffer    
  Pointer   to   the   buffer   to   receive   the   null-terminated   string   containing   the   path.   This   path   does   not   end   with   a   backslash   unless   the   system   directory   is   the   root   directory.   For   example,   if   the   system   directory   is   named   WINDOWS\SYSTEM   on   drive   C,   the   path   of   the   system   directory   retrieved   by   this   function   is   C:\WINDOWS\SYSTEM.    
  uSize    
  Specifies   the   maximum   size   of   the   buffer,   in   characters.   This   value   should   be   set   to   at   least   MAX_PATH.    
  Return   Values  
  If   the   function   succeeds,   the   return   value   is   the   length,   in   characters,   of   the   string   copied   to   the   buffer,   not   including   the   terminating   null   character.   If   the   length   is   greater   than   the   size   of   the   buffer,   the   return   value   is   the   size   of   the   buffer   required   to   hold   the   path.    
   
  If   the   function   fails,   the   return   value   is   zero.   To   get   extended   error   information,   callGetLastError.    
   
  Top

相关问题

  • VC++小问题,我想获得一个目录路径。
  • vc中怎么得到window的system32目录的路径?急!!!
  • VC如何获取执行程序的目录路径
  • 怎样找到当前系统windows目录路径或者program files路径
  • 怎么得到Windows的Temporary Internet Files目录路径?
  • 提问:Windows的桌面目录的路径如何取得?
  • 怎么用VC修改当前所在目录的路径名称?
  • vc中,已知IIS的虚拟目录,如何知道它所对应的硬盘路径
  • 获取mssql7\data目录的全路径
  • 怎样取得根目录的路径?

关键词

  • root
  • usize
  • lpbuffer
  • directory
  • buffer
  • retrieved
  • path
  • specified
  • uint
  • drive

得分解答快速导航

  • 帖主:tangl_99
  • breath

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

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