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

نسخة كاملة : تغيير مكان زر إبدأ
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم
هذا كود سورس لتغيير مكان زر إبدأ
جميل جدا...
PHP كود :
MoveWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), x, y, nWidth, nHeight, True); 
اذا امكن تفصيل الكود البرمجي

1- كيف اجعل الحركه آليه --- (بقيمة ثابته) -- و كيف اجعله ينطلق من 0 الى نهاية شريط المهام بالكود

وجزااك الله خيراً
كود :
unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Déclarations privées } lar:Integer; fpo:TRect; H,Hand: THandle; b:boolean; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); public { Déclarations publiques } end; var Form1: TForm1; implementation {$R *.dfm} Const Pas=10; procedure FindChildWindows(Ha: Integer); var h: THandle; begin h := GetWindow(Ha, GW_CHILD); While h <> 0 do Begin InvalidateRect(H,nil,True); FindChildWindows(h); h := GetWindow(h, GW_HWNDNEXT); End; end; procedure TForm1.FormCreate(Sender: TObject); var po:TRect; begin // Application.ShowMainForm:=False; H := FindWindow('Shell_TrayWnd', nil); Hand := FindWindowEx(H, 0, 'Button', nil); GetWindowRect(H,Po); GetWindowRect(Hand,fPo); fpo.Bottom:=fpo.Bottom-fpo.Top; fpo.Top:=0; fpo.Right:=fpo.Right-fpo.Left; lar:=po.Right; b:=False; Timer1:=TTimer.Create(nil); Timer1.Enabled:=False; Timer1.OnTimer:=Timer1Timer; Timer1.Interval:=100; Timer1.Enabled:=true; end; procedure TForm1.FormDestroy(Sender: TObject); begin Timer1.Enabled:=False; Timer1.Free; MoveWindow(Hand,0,0,fpo.Right,fpo.Bottom,false); InvalidateRect(H,nil,True); FindChildWindows(h); end; procedure TForm1.Timer1Timer(Sender: TObject); var n:integer; begin case b of False:begin n:=fpo.Left+pas; if n+fpo.Right<lar then fpo.Left:=n else b:=True; end; True:begin if fpo.Left>pas then fpo.Left:=fpo.Left-pas else b:=False; end; end; MoveWindow(Hand,fpo.Left,fpo.Top,fpo.Right,fpo.Bottom,false); InvalidateRect(H,nil,True); FindChildWindows(h); end; end.
أو en mode consol
كود :
program Project1; {$APPTYPE CONSOLE} uses Windows, Messages; Const Pas=10; var lar:Integer; fpo:TRect; H,Hand,Timer: THandle; b:boolean; procedure FindChildWindows(Ha: Integer); var h: THandle; begin h := GetWindow(Ha, GW_CHILD); While h <> 0 do Begin InvalidateRect(H,nil,True); FindChildWindows(h); h := GetWindow(h, GW_HWNDNEXT); End; end; procedure Timer1Timer; var n:integer; begin case b of False:begin n:=fpo.Left+pas; if n+fpo.Right<lar then fpo.Left:=n else b:=True; end; True:begin if fpo.Left>pas then fpo.Left:=fpo.Left-pas else b:=False; end; end; MoveWindow(Hand,fpo.Left,fpo.Top,fpo.Right,fpo.Bottom,false); InvalidateRect(H,nil,True); FindChildWindows(h); end; procedure FormCreate; var po:TRect; begin Timer:=SetTimer(0,0,100,nil); H := FindWindow('Shell_TrayWnd', nil); Hand := FindWindowEx(H, 0, 'Button', nil); GetWindowRect(H,Po); GetWindowRect(Hand,fPo); fpo.Bottom:=fpo.Bottom-fpo.Top; fpo.Top:=0; fpo.Right:=fpo.Right-fpo.Left; lar:=po.Right; b:=False; end; Procedure FormDestroy(n:Dword); begin MoveWindow(Hand,0,0,fpo.Right,fpo.Bottom,false); InvalidateRect(H,nil,True); FindChildWindows(h); KillTimer(Timer,0); end; var Msg: TMsg; begin SetConsoleCtrlHandler(@FormDestroy,True); FormCreate; repeat if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) and (msg.message=WM_TIMER) then Timer1Timer; until False; end.
من أجل العمل في الخفاء يكفي حذف
كود :
{$APPTYPE CONSOLE}
هذا الرد لي وألا مشاركه منك في الموضوع

وشكراً
قديم الشوق كتب :هذا الرد لي وألا مشاركه منك في الموضوع

وشكراً

لك طبعا :brow:
الله يجزاك خير

يليت تضع الرسورس طبقت وطلع عندي أخطأ

وجزاك الله خير
قديم الشوق كتب :الله يجزااك خير

يليت تضع الرسورس طبقت وطلع عندي أخطأ

وجزااك الله خير

أنا أستعمل delphi6
أما السورس، ما عليك إلا نقل الكود الثاني الذي يعمل في mode consol
هناك أخطاء في الكود الأول
اما الكود الثاني يعمل تمام
وشكراً