我是Win2000 Profesional操作系统,VC6.0,在编写钩子程序时,明明把头文件已经定义好了,可是还是告诉我KBDLLHOOKSTRUCT和WH_KEYBOARD_LL没定义源文件开始我已经定义如下:
#define _WIN32_WINNT 0x0500
#include <afxwin.h>#include "stdafx.h"
#include "Keyboard.h"
#include "Winuser.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif可是还是不行,我从网上下的钩子程序却可以,我不知道差在哪里了,大侠们救命啊!!
#define _WIN32_WINNT 0x0500
#include <afxwin.h>#include "stdafx.h"
#include "Keyboard.h"
#include "Winuser.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif可是还是不行,我从网上下的钩子程序却可以,我不知道差在哪里了,大侠们救命啊!!
#include "Winuser.h"//提前到这里试试我想该在#include "Keyboard.h"前
#include "stdafx.h"
#include "Keyboard.h"
WH_KEYBOARD_LL
/*
* Low level hook flags
*/
#define LLKHF_EXTENDED 0x00000001
#define LLKHF_INJECTED 0x00000010
#define LLKHF_ALTDOWN 0x00000020
#define LLKHF_UP 0x00000080#define LLMHF_INJECTED 0x00000001/*
* Structure used by WH_KEYBOARD_LL
*/
typedef struct tagKBDLLHOOKSTRUCT {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
DWORD dwExtraInfo;
} KBDLLHOOKSTRUCT, FAR *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;/*
* Structure used by WH_MOUSE_LL
*/
typedef struct tagMSLLHOOKSTRUCT {
POINT pt;
DWORD mouseData;
DWORD flags;
DWORD time;
DWORD dwExtraInfo;
} MSLLHOOKSTRUCT, FAR *LPMSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT;#endif // (_WIN32_WINNT >= 0x0400)//////////////////////////////////
以及:
#ifndef _WINUSER_
#define _WINUSER_
/////////////////////////////////
我认为是你的
#define _WIN32_WINNT 0x0500
定义得太晚,此时WINUSER.H已经被包含过.不过你可以自己定义,把定义从WINUSER中复制过来就行.
#define _WIN32_WINNT 0x0500
定义得太晚,此时WINUSER.H已经被包含过.