procedure TForm1.Button1Click(Sender: TObject); begin Timer1.Interval := 3000;//3秒後 Timer1.Enabled := true;//タイマスタート MessageBox(Handle,'Test desu','TEST',MB_OK or MB_ICONEXCLAMATION); end;
function EnumThreadWndProc(hWindow: HWND; lData: LPARAM):BOOL; stdcall; begin result := true; if GetWindow(hWindow,GW_OWNER) = Form1.Handle then begin EndDialog(hWindow,IDCANCEL);//閉じる result := false; end; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := false;//タイマストップ EnumThreadWindows(GetCurrentThreadId,@EnumThreadWndProc,0); end;