我正在为 COM 创建一个对象
Set FM_L = CreateObject("FMInterface.FMDebug")
在 VBScript 中。在 Fmdebug
中,我有一个调用 GetModuleFilename
的方法(C++ 方法)。它返回错误的文件夹路径 (C:\Windows\System32
)。
如果我从 C# 应用程序运行同一个 DLL,我会得到正确的路径。仅在 VBScript 中我得到了错误的文件夹路径。
代码:
static string ExePath() {
char buffer[MAX_PATH];
GetModuleFileName( NULL, buffer, MAX_PATH );
string::size_type pos = string( buffer ).find_last_of( "\\/" );
return string( buffer ).substr( 0, pos);
}
最佳答案
Rauls 谢谢你说 modulehandle。 使用 Modulehandle 它解决了.. 来源 - http://www.codeproject.com/Articles/16598/Get-Your-DLL-s-Path-Name
关于c++ - GetModuleFilename 返回通过 VBScript 运行的错误文件夹名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33213990/