View Full Version : سوال: در خواست كد
darrudi
یک شنبه 28 مهر 1387, 12:23 عصر
سلام .من كدي ميخواستم كه با اون برنامم هميشه روي برنامه هاي ديگه باشه بطور مثال اكه من my computer رو زدم برنامم به زير نره و هميشه ديده بشه مرسي
AliReza Vafakhah
یک شنبه 28 مهر 1387, 13:06 عصر
سلام:
اگر از دلفي 2006 يا 2007 استفاده كني اين خاصيت رو خود فرم داره
اين هم كد
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
Function SetTopMostWindow(hwnd:HWND;Topmost: Boolean):LongBool;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
SetTopMostWindow(form1.Handle,true)
end;
Function TForm1.SetTopMostWindow(hwnd:HWND;Topmost: Boolean):LongBool;
begin
If (Topmost)Then //Make the window topmost
Result:= SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE))
Else
begin
Result := SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE));
Result:= False ;
End;
end;
end.
darrudi
یک شنبه 28 مهر 1387, 15:21 عصر
سلام:
اگر از دلفي 2006 يا 2007 استفاده كني اين خاصيت رو خود فرم داره
اين هم كد
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
Function SetTopMostWindow(hwnd:HWND;Topmost: Boolean):LongBool;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
SetTopMostWindow(form1.Handle,true)
end;
Function TForm1.SetTopMostWindow(hwnd:HWND;Topmost: Boolean):LongBool;
begin
If (Topmost)Then //Make the window topmost
Result:= SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE))
Else
begin
Result := SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, (SWP_NOMOVE Or SWP_NOSIZE));
Result:= False ;
End;
end;
end.
كجاي فرم ؟
AliReza Vafakhah
یک شنبه 28 مهر 1387, 23:08 عصر
دوست عزيز خواصيت FormStyle را با مقدار fsStayOnTop مقدار دهي كن .
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.