Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Ajuda em terminar um alerta igual a do MSN


Guest AndréTbo_Iniciante

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;

[Error]Unit1.pas(41): Undeclared identifier: 'TfAlertaMsn'

[Error] Unit1.pas(41): Missing operator or semicolon

[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

vi em exemplo de alerta em mesagem igual ao do MSN

endereço do exemplo:

http://www.codigofonte.net/dicas/delphi/19...o-MSN-no-delphi

Oi andre .. vi este emplo na net tambem , mas ele ta com um errinho apenas

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, 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 := TForm1.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.

OBS : Corrigir esta linha

fAlertaMsn := TfAlertaMsn.Create(Self);

por esta

fAlertaMsn := TForm1.Create(Self);

abraço

Link para o comentário
Compartilhar em outros sites

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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...