Cursor position ?

Résolu
Taktaky Messages postés 31 Date d'inscription lundi 21 mai 2007 Statut Membre Dernière intervention 21 août 2008 - 4 juil. 2008 à 21:00
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 - 5 juil. 2008 à 11:53
Salut

cett code prendere la Position de la Serie (Cursor position)
mais je voudrais un peut deplacer la Position de Cursor avec 30 pixcel, 30 pixcel
alors left+30, top+30 (point.x, point.y) !

CursorPosition ?
// 1. Get the handle to the current mouse-cursor and its position
function GetCursorInfo2: TCursorInfo;
var
hWindow: HWND;
pt: TPoint;
pIconInfo: TIconInfo;
dwThreadID, dwCurrentThreadID: DWORD;
begin
Result.hCursor := 0;
ZeroMemory(@Result, SizeOf(Result));
// Find out which window owns the cursor
if GetCursorPos(pt)then
begin
Result.ptScreenPos : = pt;
hWindow := WindowFromPoint(pt);
if IsWindow(hWindow)then
begin
// Get the thread ID for the cursor owner.
dwThreadID : = GetWindowThreadProcessId(hWindow, nil);
 
// Get the thread ID for the current thread
dwCurrentThreadID := GetCurrentThreadId;
 
// If the cursor owner is not us then we must attach to
// the other thread in so that we can use GetCursor() to
// return the correct hCursor
if(dwCurrentThreadID <> dwThreadID)then
begin
if AttachThreadInput(dwCurrentThreadID, dwThreadID, True)then
begin
// Get the handle to the cursor
Result.hCursor : = GetCursor;
AttachThreadInput(dwCurrentThreadID, dwThreadID, False);
end;
end
else
begin
Result.hCursor := GetCursor;
end;
end;
end;
end;
 
 

Merci

3 réponses

f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
4 juil. 2008 à 22:39
heu :

var
  pnt : TPoint;
begin
  GetCursorPos(pnt);
  inc(pnt.X, 30);
  inc(pnt.Y, 30);
  SetCursorPos(pnt);
end;

<hr size="2" width="100%" />
3
Rejoignez-nous