type
TColorForm = class(TForm)
ColorGrid1: TColorGrid;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ColorForm: TColorForm;
Function FBColor(Var FColor,BColor:Tcolor):WordBool;export;
implementation
{$R *.dfm}
procedure TColorForm.BitBtn1Click(Sender: TObject);
begin
ModalResult:=mrOK;
end;
procedure TColorForm.BitBtn2Click(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
Function FBColor(Var FColor,BColor:TColor):WordBool;
begin
Result:=False;
ColorForm:=TColorForm.Create(Application);
try
if ColorForm.ShowModal=mrOK then
with ColorForm do
begin
FColor:=ColorGrid1.ForegroundColor;
BColor:=ColorGrid1.BackgroundColor;
Result:=True;
end;
finally
ColorForm.Free;
end;
end;
4、在你的程序中用下面的方法使用:
var h:THandle;
bmp:TBitmap;
begin
h:=LoadLibrary('test');
if h<=0 then
showMessage('Load Dll Error')
else begin
bmp:=TBitMap.Create;
bmp.Handle:=loadBitmap(h,'ActiveTop');
Image1.Picture.Bitmap.Assign(bmp);
canvas.Draw(0,0,bmp);
bmp.Free;
freeLibrary(h);
end;