English 中文(简体)
无国界记者协会在APICA窗户中走上可执行的道路
原标题:SAFELY get path to running executable in windows API
  • 时间:2011-01-30 06:34:33
  •  标签:
  • c++
  • windows

Hey, I m trying to get the path to a dll located in the same folder as my exe file. The way to go seems to be to use one of either QueryFullProcessImageName() or GetModuleFileName() to get the path to the running executable and then use string manipulation to make it a path to the required library instead.

不幸的是,这两项职能都没有预先确定所需的缓冲规模。 我曾试图将微粒参数推向零,但这并没有产生预期的效果。

这样做的最佳做法是什么?

最佳回答

在实践中,您可使用Windows AP <>>>>>> 代码作为你的缓冲尺寸,或许可以增加1个额外安全系数。

页: 1 如同I.A.S.A.S.R.S.R.S.R.S.R.S.O.S.O.S.O.A.,A.S.R.A.O.A.,A.A.O.A.,A.A.S.O.,A.A.,A.O.A.A.,A.O.A.A.O.A.A.A.O.A.A.O.A.O.A.A.A.O.A.A.A.A.A.O.A.A.A.A.A.A.A.O.O.O.O.O.A.A.A.A.A.A.O.A.A.A.A.A.A.A.A.A.O.A.A.A.A.A.A.A.A.A.O.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A. 然而,对于这个大型航天公司来说,它必须是星号,而重要的是,“探索”并不支持这种大型航天飞机,因此它实际上不是一个问题。

在实践中,如果你碰到如此大的道路,显然不可能去除,那么你可以使用统法协会的命名(为一条特别的序号,用于长途),和(或)相当的短名(监督事务司8.3个名称),和(或)确定缩短道路的逻辑动力,以便删除名录/档案。

Cheers & hth.,

问题回答

<代码>GetModuleFilename将照抄的特性数目退回到你的缓冲地带。 如果其规模低于你的缓冲,你将重罚。 如果等于你的缓冲面积,则分配更大的缓冲,并再次尝试。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签