//------------------------------------------------------------------------------
//Global.pas
//共享模块,保存字符串资源和共享常量、变量、函数及过程
//------------------------------------------------------------------------------
unit Global;
interface
uses
Messages,Controls,Classes,Forms,windows,Variants;
function MsgBox(Msg:Variant;Title:string='';Flag:longint=0):integer;
implementation
function MsgBox(Msg:Variant;Title:string='';Flag:longint=0):integer;
//简化MessageBox函数
begin
if length(title)=0 then
title:=SAppName;
if flag=0 then
flag:=MB_OK + MB_ICONINFORMATION;
Result:=application.MessageBox(pchar(vartostr(Msg)),pchar(Title),flag);
end;
//------------------------------------------------------------------------------
//TForm1.pas
//------------------------------------------------------------------------------
unit MDIMain;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Forms,Global;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
protected
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
MsgBox('OK');
end;