在vc++中如何得到当前应用程序的路径

char   path[MAX_PATH];  
  GetModuleFileName(NULL,path,MAX_PATH);

GetModuleFileName(   AfxGetInstanceHandle(),szPath,MAX_PATH);


GetModuleFileNameEx  
  The   GetModuleFileNameEx   function   retrieves   the   fully   qualified   path   for   the   specified   module.    
   
  DWORD   GetModuleFileNameEx(  
      HANDLE   hProcess,         //   handle   to   the   process  
      HMODULE   hModule,         //   handle   to   the   module  
      LPTSTR   lpFilename,     //   buffer   that   receives   the   path  
      DWORD   nSize                   //   size   of   the   buffer  
  );  
     
  Parameters  
  hProcess    
  Handle   to   the   process   that   contains   the   module.    
  hModule    
  Handle   to   the   module.    
  lpFilename    
  Pointer   to   the   buffer   that   receives   the   fully   qualified   path   to   the   module.    
  nSize    
  Specifies   the   size,   in   bytes,   of   the   lpFilename   buffer.    
  Return   Value  
  If   the   function   succeeds,   the   return   value   specifies   the   length   of   the   string   copied   to   the   buffer.    
   
  If   the   function   fails,   the   return   value   is   zero.   To   get   extended   error   information,   call   GetLastError.    
   
  See   Also  
  Process   Status   Helper   Overview,   PSAPI   Functions,   EnumProcesses,   GetModuleBaseName     
   

posted on 2009-03-14 10:00 wrh 阅读(1460) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2011年8月>
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910

统计

常用链接

留言簿(19)

随笔档案

文章档案

收藏夹

搜索

最新评论

阅读排行榜

评论排行榜