delphi4arab منتديات دلفي للعرب

نسخة كاملة : سؤال بخصوص الدالة SetCursorPos المتعلقه بالماوس
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم

اود ان تقرأ الدالة من listbox او edit او اي اداة يوضع فيها x,y الخاص باحداثيات الماوس

كود :
SetCursorPos(x,y);

بحيث اقراها متتاليه

إقتباس :SetCursorPeos reading from list


delphi 7
قرائة ممتاليه داخل listbox
كود :
procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; // Disable timer to avoid re-entry during processing   try     // Process the currently selected item     if ListBox1.ItemIndex <> -1 then     begin       // Example: Display the selected item       ListBox1.Items[ListBox1.ItemIndex];       // Add your specific processing logic here     end;     // Move to the next item     if ListBox1.ItemIndex < ListBox1.Items.Count - 1 then     begin       ListBox1.ItemIndex := ListBox1.ItemIndex + 1;     end     else     begin       ListBox1.ItemIndex := -1; // Reset or indicate end of list     end;   finally     // Re-enable timer if there are more items to process     Timer1.Enabled := (ListBox1.ItemIndex > -1);   end;

عند الضغط ع الزر يعمل الكود السابق
كود :
Button1Click


كود :
procedure TForm1.Button1Click(Sender: TObject); begin ListBox1.ItemIndex := 0; // Start from the first item   Timer1.Enabled := True; end;

Timer  = 100
كود :
procedure TForm1.Timer1Timer(Sender: TObject); var   pt : TPoint;   HH : hWnd; begin   GetCursorPos(pt);   Edit1.Text := inttostr(pt.x)+' : '+inttostr(pt.y);   end;

Timer  = 100
كود :
procedure TForm1.Timer4Timer(Sender: TObject); begin Memo1.Lines.Add(Edit1.Text); end;

__________________________________________________________________________________________


كود :
var   CurrentValue: Integer;   NewValue: string; begin   // تأكد من أن مربع النص يحتوي على عدد صحيح   if TryStrToInt(Edit1.Text, CurrentValue) then   begin     // قم بإضافة 5 إلى القيمة الحالية     CurrentValue := CurrentValue + 5;     // حول القيمة الجديدة إلى سلسلة نصية     NewValue := IntToStr(CurrentValue);     // قم بتحديث قيمة مربع النص     Edit1.Text := NewValue;   end   else   begin     // إذا لم يكن النص في مربع النص عددًا صحيحًا     ShowMessage('يرجى إدخال عدد صحيح في مربع النص.');   end; end;


click
كود :
procedure TForm1.Button1Click(Sender: TObject); begin SetCursorPos(686,313); // Move the cursor to the desired position       mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); // Simulate left button down       mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);  // Simulate left button up end;


التعديل ع السطر اضافة
كود :
procedure TForm1.AddClick(Sender: TObject); var   Str1 : String; begin Str1 := Edit1.Text; insert(Edit3.Text+' : ' , Str1, 9 ); Edit2.Text := Str1; ListBox1.Items.Add(Edit2.Text); end;