如何能让我的消息框定时弹到最前面??(100分)

S

shlgz

Unregistered / Unconfirmed
GUEST, unregistred user!
如何能让我的消息框定时弹到最前面??请各位大侠帮帮我!
 
1.定时就不用我说了
2.弹到最前面的话用两个函数合用,保证会弹到最前面,最好把FormStyle=fsStayOntop
SetForeGroundWindow(Form1.Handle);
ShowWindow(Form1.Handle,1);
 
win98可以,但win2000改了机制,只是在任务条上闪烁
 
你可以写一个自己的窗口,我这里有个例子,你可以试试
unit uMSGForm;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;

type
TfrmMessage = class(TForm)
lblMSGBody: TLabel;
sbHide: TSpeedButton;
imgICON: TImage;
lblTitle: TLabel;
TimerHideWindow: TTimer;
procedure FormPaint(Sender: TObject);
procedure sbHideClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TimerHideWindowTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams); override;
end;

var
frmMessage: TfrmMessage;

implementation

{$R *.dfm}

procedure TfrmMessage.FormPaint(Sender: TObject);
var
i: word;
dx,x: real;
begin
dx := ClientWidth/256;
x := 0;
for i:=0 to 255 do
begin
Canvas.Brush.Color := $CCFFCC - (Round(i / 3) * $10001);
Canvas.FillRect(Rect(Round(x),0,Round(x+dx),ClientHeight));
x := x + dx;
end;
end;

procedure TfrmMessage.sbHideClick(Sender: TObject);
begin
Close;
end;

procedure TfrmMessage.FormCreate(Sender: TObject);
begin
Top := Screen.WorkAreaHeight - ClientHeight;
Left := Screen.WorkAreaWidth - ClientWidth;
end;

procedure TfrmMessage.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
Params.WndParent := GetDesktopWindow;
end;

procedure TfrmMessage.TimerHideWindowTimer(Sender: TObject);
begin
frmMessage.Free;
end;

end.
 
谢谢各位,我已经找到解决方法了.
 
顶部