Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Delphi Examples

Delphi Examples 4 years 2 months ago #3875

LPQRCODECONTEXT = ^TQRCODECONTEXT;
TQRCODECONTEXT = record
nVersion : integer;
nCorrectionLevel : integer;
nEncodeMode : integer;
nEci : integer;
nFnc1Mode :integer;
nStructuredAppendIndex : integer;
nStructuredAppendCounter : integer;
nApplicationIndicator : integer;
bStructuredAppend : boolean;
bProcessTilde: boolean;
bAutoConfigurate: boolean;
cData: array[1..7100] of char;
nSize : integer;
nMargin : BYTE;
nPixelSize : BYTE;
clBackGround : TColor;
clForeGround : TColor;
end;

procedure InitWorkSpace(pQRCodeCtx : LPQRCODECONTEXT ); stdcall; external 'QRCODEENCODEDLL.DLL';
function QRCodeEncode2File(pQRCodeCtx : LPQRCODECONTEXT;lpImageFile :PChar) : boolean; stdcall;external 'QRCODEENCODEDLL.DLL';
function QRCodeEncode2Bitmap(pQRCodeCtx : LPQRCODECONTEXT) : HBITMAP;stdcall;external 'QRCODEENCODEDLL.DLL';
function FreeWorkSpace : boolean;stdcall external 'QRCODEENCODEDLL.DLL';

procedure TForm1.Button1Click(Sender: TObject);
var
ctx : TQRCODECONTEXT;
s : string;
i : Integer;
bmp : HBITMAP;
img : TBitmap;
pCtx : LPQRCODECONTEXT;
begin
pCtx := @ctx;
InitWorkSpace(pCtx);
ctx.nVersion := Combobox1.ItemIndex + 1;
ctx.nCorrectionLevel := Combobox3.ItemIndex;
ctx.nEncodeMode := Combobox4.ItemIndex;
ctx.nFnc1Mode := Combobox5.ItemIndex;

ctx.nStructuredAppendIndex := StrToInt(Edit1.Text);
ctx.nStructuredAppendCounter := StrToInt(Edit6.Text);
ctx.bStructuredAppend := CheckBox1.checked;
ctx.bProcessTilde := CheckBox2.checked;
ctx.bAutoConfigurate := CheckBox3.checked;
ctx.nMargin := StrToInt(Edit3.Text);
ctx.nPixelSize := StrToInt(Edit4.Text);
ctx.clBackGround := ColorBox1.Color;
ctx.clForeGround := ColorBox2.Color;
if (Edit5.Text <> '') then StrMove(@ctx.cData,PChar(Edit5.Text),Length(Edit5.Text));

image1.Picture.CleanupInstance;
bmp := QRCodeEncode2Bitmap(pCtx);
img := TBitmap.Create;
img.Handle := bmp;
image1.Picture.Assign(img);
img.Free;
ShowMessage('Make QRCode barcode successfully');
FreeWorkSpace();
end;
The administrator has disabled public write access.

  • Posts:59
  • developer's Avatar
  • developer
  • Moderator
  • OFFLINE
  • Karma: 1
  • Page:
  • 1
Time to create page: 0.982 seconds
Powered by Kunena Forum :: Wibi