⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_60100.htm

📁 vc
💻 HTM
字号:
<p>
序号:60100 发表者:robslove 发表日期:2003-11-11 20:25:26
<br>主题:如何得到文件路径!!!
<br>内容:前几天偶然看到一个朋友的回复<BR>说是把要用的文件(比如一个网页文件)<BR>放在.exe的目录下后<BR>GetMoudalFileName解出路径<BR>加上xxx.htm<BR>再用这个串<BR><BR>不知道<BR>GetMoudalFileName<BR>是不是误写的<BR>GetModuleFileName<BR>The GetModuleFileName function retrieves the full path and filename for the executable file containing the specified module. <BR><BR>Windows 95: The GetModuleFilename function will return long filenames when an application's version number is greater than or equal to 4.00 and the long filename is available. Otherwise, it returns only 8.3 format filenames.<BR><BR>DWORD GetModuleFileName(<BR>&nbsp;&nbsp;HMODULE hModule,&nbsp;&nbsp;&nbsp;&nbsp;// handle to module to find filename for<BR>&nbsp;&nbsp;LPTSTR lpFilename,&nbsp;&nbsp;// pointer to buffer to receive module path<BR>&nbsp;&nbsp;DWORD nSize&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // size of buffer, in characters<BR>);<BR> 但我看下面的函数好象又不是返回的一个文件路径名<BR><BR>不知道还有没其他方法?<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:樂日華 回复日期:2003-11-11 20:37:27
<br>内容:CString CStructProc::GetExePath()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;char DBFileName[MAX_PATH];<BR>&nbsp;&nbsp;&nbsp;&nbsp;GetModuleFileName(AfxGetInstanceHandle(), DBFileName, MAX_PATH);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CString m_strExePath;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_strExePath = DBFileName;<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_strExePath = m_strExePath.Mid(0, m_strExePath.ReverseFind('\\'));<BR>&nbsp;&nbsp;&nbsp;&nbsp;return m_strExePath;<BR>}<BR><BR>m_strExePath 就是當前程序運行的路徑. 
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:robslove 回复日期:2003-11-11 21:34:25
<br>内容:。。。<BR>2003-11-11 22:05:19

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -