함수 포인터
unit MainFrm
uses
FrmInt
type
TFrmMain = class(TForm)
private
FWinForm: IWin32Form; ....
implementation
uses WinNTFrm, Win9xFrm;
procedure TFrmMain.FormCreate(Sender: TObject);
begin
if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
FWinForm := TFrmWin9x.Create
else
if Win32Platform = VER_PLATFORM_WIN32_NT then
FWinForm := TFrmWinNT.Create
else
raise Exception.Create('This application can run on Win32');
end;
......
end.
아래가 인터페이스 유닛
unit FrmInt; interface
uses Classes, ComCtrls, Controls;
type
IWin32Frm = interface // 함수 선언만 한다
procedure FillList(ListView: TListView);
procedure ShowList(ListView: TListView);
end;
implementation
end.
아래가 Win9x 에서 작동하는 폼
unit Win9xFrm;
interface
uses Windows, FrmInt, Classes, Controls, ComCtrls;
type
TFrmWin9x = class(TInterfacedObject, IWin32Frm)
public
procedure FillList(ListView: TListView);
procedure ShowList(ListView: TListView);
end;
implementaion // 함수 구현
end.
아래가 WinNT 에서 작동하는 폼
unit WinNTFrm;
interface
uses Windows, FrmInt, Classes, Controls, ComCtrls;
type
TFrmWinNT = class(TInterfacedObject, IWin32Frm)
public
procedure FillList(ListView: TListView);
procedure ShowList(ListView: TListView);
end;
implementaion // 함수 구현
end.
'Delphi > 문법' 카테고리의 다른 글
델파이 포인터 (Pointer) 10편 (0) | 2023.08.23 |
---|---|
델파이 포인터 (Pointer) 9편 (0) | 2023.08.22 |
델파이 포인터 (Pointer) 7편 (0) | 2023.08.11 |
델파이 포인터 (Pointer) 6편 (0) | 2023.08.10 |
델파이 포인터 (Pointer) 5편 (0) | 2023.08.09 |
댓글