当前文件名和文件路径 [英] Current Filename and File path
问题描述
大家好,
可能是一个非常简单的答案,但到目前为止我遇到了麻烦
找到答案。我正在编写一个非托管VC ++应用程序,我需要从应用程序内部获取当前正在执行的文件名和文件路径。
所以,如果我在目录C中:\ Program Files \ Test_Dir和我运行TestApp
(.exe文件),我需要获取当前目录(" C:\Program
Files \ Test_ir")和应用程序的完整文件名(TestApp.exe)。任何
的想法都表示赞赏。
谢谢
Hi all,
Probably a really simple answer to this, but so far I''m having trouble
locating the answer. I''m writing an unmanaged VC++ app and I need to grab
the currently executing filename and file path from inside the application.
So if I am in the directory C:\Program Files\Test_Dir and I run TestApp
(.exe file), I need to grab the current directory ("C:\Program
Files\Test_Dir") and the application''s full filename ("TestApp.exe"). Any
ideas are appreciated.
Thanks
推荐答案
" Mike C#" < xy*@xyz.com>在留言中写道
news:ur ************** @ TK2MSFTNGP04.phx.gbl ...
"Mike C#" <xy*@xyz.com> wrote in message
news:ur**************@TK2MSFTNGP04.phx.gbl...
我正在写作一个非托管的VC ++应用程序,我需要从应用程序内部获取当前正在执行的文件名和文件路径。
I''m writing an unmanaged VC++ app and I need to grab the currently
executing filename and file path from inside the application.
检查GetModuleFileName的文档(0 ,. ..);
问候,
将
Check the docs for GetModuleFileName(0, ...);
Regards,
Will
谢谢,我我会调查一下。我担心我不得不做一些时髦的事情
与进程ID一分钟:)谢谢
" William DePalo [MVP VC ++]" < WI *********** @ mvps.org>在消息中写道
news:ui ************** @ TK2MSFTNGP03.phx.gbl ...
Thanks, I''ll look into it. I was afraid I would have to do something funky
with the process id for a minute :) Thanks
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:ui**************@TK2MSFTNGP03.phx.gbl...
" Mike C#" < xy*@xyz.com>在消息中写道
新闻:ur ************** @ TK2MSFTNGP04.phx.gbl ...
"Mike C#" <xy*@xyz.com> wrote in message
news:ur**************@TK2MSFTNGP04.phx.gbl...
我正在编写一个非托管VC ++应用程序我需要从应用程序内部获取当前正在执行的文件名和文件路径。
I''m writing an unmanaged VC++ app and I need to grab the currently
executing filename and file path from inside the application.
检查GetModuleFileName(0,...)的文档;
问候,
Check the docs for GetModuleFileName(0, ...);
Regards,
Will
" Mike C#" < xx*@yyy.com>在消息新闻中写道:0z ************** @ fe12.lga ...
"Mike C#" <xx*@yyy.com> wrote in message news:0z**************@fe12.lga...
检查GetModuleFileName的文档(0 ,...);
问候,
将
Check the docs for GetModuleFileName(0, ...);
Regards,
Will
谢谢Will,它很棒!
那么,是否有一种方法可以从当前流程中获取资源(即版本号,
版权等)?目前我不得不再次打开文件(因此GetModuleFileName调用)来读取
资源。似乎应该有一种方法从
内存中获取资源,因为文件已经加载并正在执行。再次感谢!
Thanks Will, it works great!
By the way, is there a method for grabbing resources (i.e., version number,
copyright, etc.) from within the current process? Currently I''m having to
open the file again (hence the GetModuleFileName call) to read the
resources. It seems like there should be a way to grab the resources from
memory, since the file is already loaded and executing. Thanks again!
这篇关于当前文件名和文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!