在.h中定义
#ifdef HOOK_EXPORTS
#define HOOK_API __declspec(dllexport)//问题1:什么意思,看了 MSDN不懂
#else
#define HOOK_API __declspec(dllimport)
#endif HOOK_API BOOL EnableKeyboardCapture();//问题2:函数返回类型前面加这个代表什么?
HOOK_API BOOL DisableKeyboardCapture();
// This class is exported from the HOOK.dll
class HOOK_API CHOOK {
public:
CHOOK(void);
// TODO: add your methods here.
};extern HOOK_API int nHOOK;//问题:这个extern为什么?HOOK_API int fnHOOK(void);//同问题2
谢谢了,各位高手!
#ifdef HOOK_EXPORTS
#define HOOK_API __declspec(dllexport)//问题1:什么意思,看了 MSDN不懂
#else
#define HOOK_API __declspec(dllimport)
#endif HOOK_API BOOL EnableKeyboardCapture();//问题2:函数返回类型前面加这个代表什么?
HOOK_API BOOL DisableKeyboardCapture();
// This class is exported from the HOOK.dll
class HOOK_API CHOOK {
public:
CHOOK(void);
// TODO: add your methods here.
};extern HOOK_API int nHOOK;//问题:这个extern为什么?HOOK_API int fnHOOK(void);//同问题2
谢谢了,各位高手!
#define HOOK_API __declspec(dllexport)//问题1:什么意思,看了 MSDN不懂
#else
#define HOOK_API __declspec(dllimport)
#endif__declspec(dllexport) 导出至DLL,增加DLL导出表项
__declspec(dllimport) 导入DLL函数,增加应用程序导入表项
在应用程序中,使用__declspec(dllimport)导入Hook DLL中的函数
__declspec(dllexport) 导出DLL函数,增加DLL导出表项
__declspec(dllimport) 导入DLL函数,增加应用程序导入表项
这样在你的DLL河应用程序中就可以同时使用同一个头文件了,就这点好处了!
extern "C" 或许会更多一点