P
pertty
Unregistered / Unconfirmed
GUEST, unregistred user!
郁闷啊!下面这段代码是dll中的键盘钩子的回调函数,想在这个回调函数中打开
dll中的窗体!但是现在连编译都过不了。
unit drProc;
interface
uses
Windows, SysUtils;
var
hNextHookProc: HHook;
procSaveExit: Pointer;
function KeyboardHookProc(code: Integer; wparam: WPARAM;
lparam: LPARAM): LRESULT stdcall; export;
function CreateKeyboardHook: BOOL; stdcall; export;
function DestroyKeyboardHook: BOOL; stdcall; export;
procedure KeyboardHookExit;
implementation
var
GameSwitch: Word; //程序热键
function KeyboardHookProc(code: Integer; wparam: WPARAM;
lparam: LPARAM): LRESULT;
const
_KeyProcessMask = $80000000;
begin
Result := 0;
if code < 0 then
begin
Result := Windows.CallNextHookEx(hNextHookProc, code, wparam, lparam);
Exit;
end;
if ((lparam and _KeyProcessMask) = 0) and (wparam = GameSwitch) then
begin
Application.Handle := GetForegroundWindow; //返回当前窗口句柄
Result := 1;
end;
end;
到底是那里的问题呢?编译提示错误在application没有定义。。
谢谢拉!!
dll中的窗体!但是现在连编译都过不了。
unit drProc;
interface
uses
Windows, SysUtils;
var
hNextHookProc: HHook;
procSaveExit: Pointer;
function KeyboardHookProc(code: Integer; wparam: WPARAM;
lparam: LPARAM): LRESULT stdcall; export;
function CreateKeyboardHook: BOOL; stdcall; export;
function DestroyKeyboardHook: BOOL; stdcall; export;
procedure KeyboardHookExit;
implementation
var
GameSwitch: Word; //程序热键
function KeyboardHookProc(code: Integer; wparam: WPARAM;
lparam: LPARAM): LRESULT;
const
_KeyProcessMask = $80000000;
begin
Result := 0;
if code < 0 then
begin
Result := Windows.CallNextHookEx(hNextHookProc, code, wparam, lparam);
Exit;
end;
if ((lparam and _KeyProcessMask) = 0) and (wparam = GameSwitch) then
begin
Application.Handle := GetForegroundWindow; //返回当前窗口句柄
Result := 1;
end;
end;
到底是那里的问题呢?编译提示错误在application没有定义。。
谢谢拉!!