PR

Delphi Hello World!

初めてDelphiを使ってみた。まずはお約束のHelloWorld。VBとの比較もやってみます。

スポンサードリンク

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Handles Button1.Click
Call Hello.MSG()
End Sub

End Class

Public Module Hello
Public Sub MSG()
MsgBox(“Hello World”)
End Sub
End Module

▲VisualBasic2008でHelloWorldを行う場合のサンプル

unit t_HelloWorld;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, System.ComponentModel, Borland.Vcl.StdCtrls, Hello;

type
TForm2 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private 宣言 }
public
{ Public 宣言 }
end;

var
Form2: TForm2;

implementation

{$R *.nfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
DispMSG;
end;
end.

unit Hello;

interface

uses  Dialogs;
procedure  DispMSG;

implementation

procedure  DispMSG;
begin
ShowMessage(‘Hello’);
end;

end.

▲Delphiで同様のことをする場合

コメント