RomanTim
Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору 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 } class function Method1(Parameter: Pointer): DWORD; static; stdcall; procedure WMUser(var Msg: TMessage); message WM_USER; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var tid: Cardinal; begin Caption := 'Waiting thread...'; CreateThread(nil, 0, @TForm1.Method1, Pointer(Handle), 0, tid); end; class function TForm1.Method1(Parameter: Pointer): DWORD; begin Sleep(5000); PostMessage(Integer(Parameter), WM_USER, 0, 0); Result := 0; end; procedure TForm1.WMUser(var Msg: TMessage); begin Caption := 'Thread finished'; end; end. | Всего записей: 375 | Зарегистр. 11-09-2003 | Отправлено: 14:43 13-10-2006 | Исправлено: RomanTim, 14:58 13-10-2006 |
|