比如:
eHandle:=CreateWindow('Edit',Nil,WS_CHILD or WS_VISIBLE or WS_BORDER,0,0,120,20,Self.Handle,0,hInstance,Nil);
OldWndProc:=Pointer(GetWindowLong(eHandle,GWL_WNDPROC));
SetWindowLong(eHandle,GWL_WNDPROC,LongInt(@EditWndProc));
function EditWndProc(hwnd: HWnd; Msg: Cardinal; wParam, lParam: Integer): Integer; stdcall;
begin
if Msg = WM_KEYDOWN then
begin
ShowMessage('123');
end;
Result := CallWindowProc(OldWndProc,hwnd,Msg,wParam,lParam);
end;