CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

请教当前工程目录路径问题...

楼主pianyun(片云)2006-03-03 11:26:25 在 VC/MFC / 基础类 提问

vb中可以用app.path代表当前的工程目录,vc中是否有类似app这样的类?要得到当前工程所在的目录该怎么办? 问题点数:20、回复次数:4Top

1 楼syy64(太平洋)回复于 2006-03-03 11:30:59 得分 5

GetCurrentDirectory  
  The   GetCurrentDirectory   function   retrieves   the   current   directory   for   the   current   process.    
   
  DWORD   GetCurrentDirectory(  
      DWORD   nBufferLength,     //   size,   in   characters,   of   directory   buffer  
      LPTSTR   lpBuffer               //   pointer   to   buffer   for   current   directory  
  );  
   
  Top

2 楼BombZhang(我当大哥很久了)回复于 2006-03-03 11:53:27 得分 5

void   GetProjectDir(char   strDir[MAX_FULLPATHNAME_LEN])  
  {  
  char   strSystemDir[MAX_PATH];  
   
  memset(strSystemDir,   0,   MAX_PATH);  
  GetModuleFileName(NULL,strSystemDir,MAX_PATH);  
   
  CString   tempstring=strSystemDir;  
  tempstring=tempstring.Left(tempstring.ReverseFind('\\'));  
  strcpy(strDir,tempstring.GetBuffer(tempstring.GetLength()));  
  }Top

3 楼js_gary(李祥)回复于 2006-03-03 12:38:40 得分 5

GetCurrentDirectory  
  The   GetCurrentDirectory   function   retrieves   the   current   directory   for   the   current   process.    
   
  DWORD   GetCurrentDirectory(  
      DWORD   nBufferLength,     //   size   of   directory   buffer  
      LPTSTR   lpBuffer               //   directory   buffer  
  );  
  Parameters  
  nBufferLength    
  [in]   Specifies   the   length,   in   TCHARs,   of   the   buffer   for   the   current   directory   string.   The   buffer   length   must   include   room   for   a   terminating   null   character.    
  lpBuffer    
  [out]   Pointer   to   the   buffer   that   receives   the   current   directory   string.   This   null-terminated   string   specifies   the   absolute   path   to   the   current   directory.    
  Return   Values  
  If   the   function   succeeds,   the   return   value   specifies   the   number   of   characters   written   to   the   buffer,   not   including   the   terminating   null   character.    
   
  If   the   function   fails,   the   return   value   is   zero.   To   get   extended   error   information,   call   GetLastError.    
   
  If   the   buffer   pointed   to   by   lpBuffer   is   not   large   enough,   the   return   value   specifies   the   required   size   of   the   buffer,   including   the   number   of   bytes   necessary   for   a   terminating   null   character.    
   
  Top

4 楼gflpower(燕赤侠)回复于 2006-03-03 12:46:10 得分 5

BombZhang(Love   our   country   !=   Love   the   party)   (   )   信  
   
   
  正解    
  Top

相关问题

  • 怎样找到当前系统windows目录路径或者program files路径
  • 如何在程序当前路径的上级路径下建立目录
  • 如何改变系统当前的目录路径改为自己想设定的目录路径?
  • 如何用JAVA获得当前执行文件所在的目录路径,和系统目录路径(c:\winnt\)
  • 如何获取当前WIN98系统目录的路径全名??
  • 如何取得相对路径的当前目录??
  • 怎样获得当前虚拟目录的完全路径?
  • 如何在c#中得到当前目录的路径
  • 在VBA里面如何取得当前word文档的当前目录路径
  • 如何获得用户当前正浏览着的当前目录路径

关键词

  • strsystemdir
  • tempstring
  • getcurrentdirectory
  • 目录
  • getcurrentdirectorythe
  • 工程
  • nbufferlength
  • strdir
  • lptstr lpbuffer
  • directory

得分解答快速导航

  • 帖主:pianyun
  • syy64
  • BombZhang
  • js_gary
  • gflpower

相关链接

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

广告也精彩

反馈

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