13,825
社区成员
发帖
与我相关
我的任务
分享
MessageDlg("测试",mtWarning, TMsgDlgButtons() << mbOK,0);
... ...
HWND hWnd;
hWnd=FindWindow("TMessageForm","Warning");
if(hWnd!=NULL)
{
SetWindowPos(hWnd, HWND_TOPMOST,0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
function MessageDlg(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
begin
Result := MessageDlgPosHelp(Msg, DlgType, Buttons, HelpCtx, -1, -1, '');
end;
function DoMessageDlgPosHelp(MessageDialog: TForm; HelpCtx: Longint; X, Y: Integer;
const HelpFileName: string): Integer;
begin
with MessageDialog do
try
HelpContext := HelpCtx;
HelpFile := HelpFileName;
if X >= 0 then Left := X;
if Y >= 0 then Top := Y;
if (Y < 0) and (X < 0) then Position := poScreenCenter;
Result := ShowModal;
finally
Free;
end;
end;
function MessageDlgPosHelp(const Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer;
const HelpFileName: string): Integer;
begin
Result := DoMessageDlgPosHelp(CreateMessageDialog(Msg, DlgType, Buttons),
HelpCtx, X, Y, HelpFileName);
end;