{******************************************************************************}
{* Иллюстрация к книге "DirectX. Графика в проектах Delphi".                  *}
{* Издательство BHV. www.bhv.ru                                               *}
{* Краснов М.В. softgl@chat.ru                                                *}
{******************************************************************************}
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

type
 TDrawBMP = procedure (Handle : THandle); stdcall;

procedure TForm1.Button1Click(Sender: TObject);
var
  hcDll : THandle;
  procDrawBMP : TDrawBMP;
begin
  hcDll := LoadLibrary('Project1.dll');
  if hcDll <= HINSTANCE_ERROR then begin
     MessageDlg ('Отсутствует библиотека Project1.dll!', mtError, [mbOK], 0);
     Exit;
  end;

  procDrawBMP := GetProcAddress(hCDll, 'DrawBMP');
  if not Assigned (procDrawBMP) then begin
     MessageDlg ('В библиотеке Project1.dll отсутствует нужная функция!', mtError, [mbOK], 0);
     Exit;
  end;
  procDrawBMP (Canvas.Handle);
  FreeLibrary(hcDll);
end;

end.
