messagebox(self.Handle,'操作成功!', '提示',MB_OK + MB_ICONASTERISK);
和
Application.MessageBox('请设置共享路径!','提示',MB_OK);
有什么不同吗?
和
Application.MessageBox('请设置共享路径!','提示',MB_OK);
有什么不同吗?
解决方案 »
- 请教关于delphi7读取内存中字符串的问题。
- 请大家快来帮忙,报表控件对Excel数据连接,读取.
- DELPHI+SQL 想要怎么学习才能快速成长 哪个前辈指点指点 请你们指教好吗
- 我用dbcomcobox控件,对datasource,datafield设定好后,为何运行时
- 急,急,急--------100
- 我要做一个报表发送,能通过网络发送到接收方的MAIL里,我怎么做?
- 关于odbc的问题
- 怎样在Dephi中实现Pc喇叭响?我用chr(7)不能实现!用汇编也不行,因为in 和out 语句出错,谁能教我怎么做?
- 进来的话对你一定有帮助,也一定有分加--一个关于指针的话题
- 图形高手:请问如何将Bmp或Jpeg文件转换成3dHome的格式文件,有大批量的图需要转换?
- OCX数字证书问题
- 急求代码:输入首字母就能查询数据库中汉字字段值
Application.MessageBox是Delphi封装的
Application.MessageBox调用了MessageBox函数
具体实现是
----------------------
function TApplication.MessageBox(const Text, Caption: PChar; Flags: Longint): Integer;
var
ActiveWindow: HWnd;
WindowList: Pointer;
MBMonitor, AppMonitor: HMonitor;
MonInfo: TMonitorInfo;
Rect: TRect;
FocusState: TFocusState;
begin
ActiveWindow := GetActiveWindow;
MBMonitor := MonitorFromWindow(ActiveWindow, MONITOR_DEFAULTTONEAREST);
AppMonitor := MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST);
if MBMonitor <> AppMonitor then
begin
MonInfo.cbSize := Sizeof(TMonitorInfo);
GetMonitorInfo(MBMonitor, @MonInfo);
GetWindowRect(Handle, Rect);
SetWindowPos(Handle, 0,
MonInfo.rcMonitor.Left + ((MonInfo.rcMonitor.Right - MonInfo.rcMonitor.Left) div 2),
MonInfo.rcMonitor.Top + ((MonInfo.rcMonitor.Bottom - MonInfo.rcMonitor.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
end;
WindowList := DisableTaskWindows(0);
FocusState := SaveFocusState;
if UseRightToLeftReading then Flags := Flags or MB_RTLREADING;
try
Result := Windows.MessageBox(Handle, Text, Caption, Flags);
finally
if MBMonitor <> AppMonitor then
SetWindowPos(Handle, 0,
Rect.Left + ((Rect.Right - Rect.Left) div 2),
Rect.Top + ((Rect.Bottom - Rect.Top) div 2),
0, 0, SWP_NOACTIVATE or SWP_NOREDRAW or SWP_NOSIZE or SWP_NOZORDER);
EnableTaskWindows(WindowList);
SetActiveWindow(ActiveWindow);
RestoreFocusState(FocusState);
end;
end;
--------------------------------- MessageBox是Windows单元的函数
可以看到Application.MessageBox调用了Windows.MessageBox 编译时要包含相应的单元
比如用到Application.Messagebox就包含Form
用到MessageBox要包含WIndows