Показать сообщение отдельно
  #2  
Старый 28.12.2010, 11:06
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Код:
unit Unit1;

interface

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

type
  TLostComponent = class(TComponent)
  public
    constructor Create(AOwner: TComponent); override;
  end;

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure WMUSER(var Msg: TMessage); message WM_USER+1973;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TlostComponent }

constructor TLostComponent.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  if AOwner is TForm then SendMessage(TForm(AOwner).Handle, WM_USER+1973, 0, 0)
  else SendMessage(Screen.Forms[0].Handle, WM_USER+1973, 0, 0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TLostComponent.Create(Application);
  TLostComponent.Create(Self);
end;

procedure TForm1.WMUSER(var Msg: TMessage);
begin
  ShowMessage('ok');
end;

end.
__________________
Пишу программы за еду.
__________________
Ответить с цитированием