Olá, eu sou iniciante em delphi e vi em exemplo de alerta em mesagem igual ao do MSN que aparece aquela telinha do lado, mas ai eu fiz e ai tá dando um erro estranho, alguém pode me ajudar??
esse são os codigos:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
fAlertaMsn: TForm;
BarraIniciar: HWND; {Barra Iniciar}
tmAltura: Integer;
tmRect: TRect;
xTop : Integer;
xIniTop : Integer;
begin
//localiza o Handle da janela iniciar
BarraIniciar := FindWindow('Shell_TrayWnd', nil);
//Pega o "retângulo" que envolve a barra e sua altura
GetWindowRect(BarraIniciar, tmRect);
tmAltura := tmRect.Bottom - tmRect.Top;
fAlertaMsn := TfAlertaMsn.Create(Self);
with fAlertaMsn do
begin
Left := Screen.Width - ClientWidth;
if tmRect.Top = -2 then
tmAltura := 30;
//Pega o top final
xTop := Screen.Height - ClientHeight - tmAltura;
//Pega o top inicial
xIniTop := Screen.Height + ClientHeight + tmAltura;
Top := xIniTop;
for I := xIniTop downto xTop do
begin
Top := Top - 1;
Show;
Update;
Application.ProcessMessages;
Sleep(10);
end;
Sleep(3000);
Close;
FreeAndNil(fAlertaMsn);
end;
end;
end.
Pergunta
Guest AndréTbo_Iniciante
Olá, eu sou iniciante em delphi e vi em exemplo de alerta em mesagem igual ao do MSN que aparece aquela telinha do lado, mas ai eu fiz e ai tá dando um erro estranho, alguém pode me ajudar??
esse são os codigos:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var I: Integer; fAlertaMsn: TForm; BarraIniciar: HWND; {Barra Iniciar} tmAltura: Integer; tmRect: TRect; xTop : Integer; xIniTop : Integer; begin //localiza o Handle da janela iniciar BarraIniciar := FindWindow('Shell_TrayWnd', nil); //Pega o "retângulo" que envolve a barra e sua altura GetWindowRect(BarraIniciar, tmRect); tmAltura := tmRect.Bottom - tmRect.Top; fAlertaMsn := TfAlertaMsn.Create(Self); with fAlertaMsn do begin Left := Screen.Width - ClientWidth; if tmRect.Top = -2 then tmAltura := 30; //Pega o top final xTop := Screen.Height - ClientHeight - tmAltura; //Pega o top inicial xIniTop := Screen.Height + ClientHeight + tmAltura; Top := xIniTop; for I := xIniTop downto xTop do begin Top := Top - 1; Show; Update; Application.ProcessMessages; Sleep(10); end; Sleep(3000); Close; FreeAndNil(fAlertaMsn); end; end; end.ai dá esse erro aqui;
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.