//Processing non-user messages in your window //To have a custom processing of messages <= WM_USER you should use SetWindowLongPtr from the Windows unit. It will return the address of the current WndProc, so you can just have your //Example: //By intercepting the WM_NCHITTEST message you can avoid dragging the window. var PrevWndProc: WNDPROC; ... //---------------------------------------------------------------------------------------------- function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall; begin if uMsg=WM_INPUT then begin // do stuff end; result:= CallWindowProc(PrevWndProc,Ahwnd, uMsg, WParam, LParam); end; //------------------------------------------------------------------------------------------------ //install our message handler procedure TForm1.FormCreate(Sender: TObject); begin PrevWndProc:=Windows.WNDPROC(SetWindowLongPtr(Self.Handle,GWL_WNDPROC,PtrUint(@WndCallback))); end; //------------------------------------------------------------------------------------------------