ShowMessage('X='+IntToStr(Mouse.CursorPos.X) +'
Y='+IntToStr(Mouse.CursorPos.Y));

Pow .. se é só pra pegar o mouse, não lhe serve este código acima não?

2008/8/1 Maycon Sanches Amaro <[EMAIL PROTECTED]>

>   Pessoal to usando uma funcao para capturar as coordenadas do mouse. Mas
> estou com um problema, ela só captura as coordenadas se o mouse estiver
> em movimento. To alimentando um memo e preciso que mesmo com o mouse
> parado ele continue recebendo os valores da posicao, pq depois to
> colocando o mouse pra executar todo o trajeto. Pensei em colocar um
> ttimer mas nao to sabendo como jogar esta funcao la pra dentro.
>
> To chamando ela assim.
>
> if FHookStarted then
> begin
> ShowMessage('Mouse is already being Journaled, can not restart');
> Exit;
> end;
> JHook := SetWindowsHookEx(WH_JOURNALRECORD, @JournalProc, hInstance, 0);
> {SetWindowsHookEx starts the Hook }
> if JHook > 0 then
> begin
> FHookStarted := True;
> end
> else
> //FHookStarted := True;
> ShowMessage('No Journal Hook availible');
> end;
>
> Segue a funcao.
>
> function JournalProc(Code, wParam: Integer; var EventStrut: TEventMsg):
> Integer; stdcall;
> var
> Char1: PChar;
> b1x,b1y,b2x,b2y,x,y: string;
> i:integer;
> begin
> {this is the JournalRecordProc}
> Result := CallNextHookEx(JHook, Code, wParam, Longint(@EventStrut));
> {the CallNextHookEX is not really needed for journal hook since it it not
> really in a hook chain, but it's standard for a Hook}
> if Code < 0 then Exit;
>
> {you should cancel operation if you get HC_SYSMODALON}
> if Code = HC_SYSMODALON then Exit;
> if Code = HC_ACTION then
> begin
> {
> The lParam parameter contains a pointer to a TEventMsg
> structure containing information on
> the message removed from the system message queue.
> }
> x := '';
> y := '';
> i:=0;
> SetLength(lArrayx, 0);
>
> if (EventStrut.message= WM_MOUSEMOVE) then
> begin
> x := 'move'+IntToStr(EventStrut.paramL);
> y := 'move'+IntToStr(EventStrut.paramH);
> end;
> Form1.Memox.Lines.Add(x+','+y);
>
> end;
> end;
>
> --
> Att.
> Maycon Sanches Amaro
> Analista de Sistemas Jr.
> Source do Brasil LTDA
> Phone: +55-19-3847-7220
> Fax: +55-19-3847-7269
> Cel: +55-19-7803-1527
>
>  
>



-- 
Abs
Daniel A. Bastos


[As partes desta mensagem que não continham texto foram removidas]

Responder a