2011-01-05 104 views
1
#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); 

----- 
-- 
} 

當我編譯代碼作爲一個單獨的項目,一切工作正常。請幫忙。編譯器錯誤:C3861「GetModuleHandleEx」:標識符找不到

回答

1

To compile an application that uses this function, define _WIN32_WINNT as 0x0501 or later. For more information, see Using the Windows Headers .

+0

您可以直接從MSDN Library文章中提供您的參考 – Bruce 2011-01-05 06:39:32

+0

。 – 2011-01-05 06:42:50

+0

它似乎我失去了我的想法:) – Bruce 2011-01-05 06:46:06