delphi 不阻塞提示对话框
{不阻塞提示对话框 TimeOut 超时参数,多久没有回应。超过时间则返回 IDTIMEOUT 默认0无限等待 返回: IDABORT (3) Abort IDCANCEL (2) Cancel IDCONTINUE (11) Continue IDIGNORE (5) Ignore IDNO (7) No IDOK (1) OK IDRETRY (4) Retry IDTRYAGAIN (10) Try Again IDYES (6) Yes IDASYNC (32001 (0x7D01)) The bWait parameter was FALSE, so the function returned without waiting for a response. IDTIMEOUT (32000 (0x7D00)) The bWait parameter was TRUE and the time-out interval elapsed. } function NoblockingMessageBox(aMessage:string;Buttons: DWORD=MB_OK;TimeOut:integer=0):DWORD;
const
WTS_CURRENT_SESSION = DWORD(-1);
begin
//用WTSGetActiveConsoleSessionId 会所有当前激活的会话都收到 改成 WTS_CURRENT_SESSION
当前的用户就可
WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, WTSGetActiveConsoleSessionId, PChar(Application.Title), Length(Application.Title), PChar(aMessage), Length(aMessage), Buttons, TimeOut, Result, False); end; { *** *** *** *** *** *** *** *** *** *** *** *** 函数 *** *** *** *** *** *** *** *** *** *** *** *** }
弹出对话框后,还会执行下面的代码。对话框独立于EXE外