【问题标题】:Compiler error:C3861 'GetModuleHandleEx': identifier not found编译器错误:C3861 'GetModuleHandleEx':找不到标识符
【发布时间】:2011-01-05 06:01:51
【问题描述】:
#include <windows.h>
#include <stdlib.h>
#include <tchar.h>
#ifdef __cplusplus
extern "C"
#endif
void * _ReturnAddress(void);

#pragma intrinsic(_ReturnAddress)
//I inserted the following code inside one of the functions

void func()
{
------------
-------
----
-
    HMODULE module_handle;
    TCHAR module_name[4096];
    DWORD flag = 0x00000004;

    GetModuleHandleEx(flag, (LPCTSTR) _ReturnAddress(), &module_handle);

    GetModuleFileName(module_handle,module_name,4096);

-----
--
}

当我将代码编译为单独的项目时,一切正常。请帮忙。

【问题讨论】:

    标签: winapi


    【解决方案1】:

    编译一个使用 这个函数,定义 _WIN32_WINNT 为 0x0501 或更高版本。了解更多信息, 见Using the Windows Headers

    【讨论】:

    • 能否提供参考
    • 直接来自 MSDN 库文章。
    • 我们在这里帮助您找回它。
    【解决方案2】:

    即使你让你的代码可以编译,你所做的事情也有错误的味道。

    如果您使用退货地址做出任何与安全相关的决定,请停止You can't trust the return address of the calling function。不,真的,you can't trust the return address of the calling function

    【讨论】:

      猜你喜欢
      • 2013-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-31
      • 1970-01-01
      • 2013-04-23
      • 1970-01-01
      相关资源
      最近更新 更多