When using a windows form application it is indeed best to use the vcl for getting them.

I want something to work independed of vcl.
I decided to give the following a try:
Code:
  var
    P: TPoint;
    Msg: TMsg;
begin
  GetCursorPos(P);
  FMouseX := P.X;
  FMouseY := P.Y;
  
  if getmessage(Msg, 0, 0, 0) then
  begin
    case Msg.message of
    WM_LBUTTONDOWN : FMouseButtons[0] := True;
    WM_LBUTTONUP : FMouseButtons[0] := False;
    WM_MBUTTONDOWN : FMouseButtons[1] := True;
    WM_MBUTTONUP : FMouseButtons[1] := False;
    WM_RBUTTONDOWN : FMouseButtons[2] := True;
    WM_RBUTTONUP : FMouseButtons[2] := False;
    end;

    //give message back for further processing
    TranslateMessage(Msg);
    DispatchMessage(Msg);
  end;
end;
Unfortunately some events are missed. I gues that is drawback of polling the windows message que.

Is there a way to set up a listener to the windows message que?

Or am i better of integrating this into an (opengl) api template as that already includes handling windows messages.

[edit]
Just thinking why not make a tthread descendantclass. So the timer can be left out also.
[/edit]