Попробуй обьяви nx как глобальную переменную для Dll, или попробуй сохранять не указатель, а процедуру.
Код:
var proc:procedure();
begin
...........................................
procedure RunStopHook(State : Boolean;nx:pointer) export; stdcall;
begin
if State=true then
begin
SysHook := SetWindowsHookEx(WH_GETMESSAGE,
@SysMsgProc, HInstance, 0);
if nx<>nil then
@proc:=nx;//запоминаем процедуру (в nx адрес процедуры left()?)
end
else//
begin
UnhookWindowsHookEx(SysHook);
SysHook := 0;
end;
end;
.....................................................................
function SysMsgProc(code : integer; wParam : word;
lParam : longint) : longint; stdcall;
begin
CallNextHookEx(SysHook, Code, wParam, lParam);
if code = HC_ACTION then
begin
Wnd := TMsg(Pointer(lParam)^).hwnd;
if TMsg(Pointer(lParam)^).message =WM_KEYDOWN then
case (TMsg(Pointer(lParam)^).wParam) of
37: begin
if left1=0 then left1:=GetTickCount();
if (GetTickCount()-left1)>=time then
begin
proc(); //вызываем процедуру
end
end;
end;
end;
end;
end;