-
В интернете нашел описание TWAIN_32.DLL, пытаюсь подключить, но выдает ошибку точки входа dll Уважаемые Мастера, подскажите в чем ошибка?
unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
type TForm1 = class(TForm) Image1: TImage; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; function TWAIN_AcquireNative(hwnd: HWND; pixmask: Integer): HBitmap;external 'TWAIN_32.dll' name 'TWAIN_AcquireNative';
function TWAIN_CreateDibPalette(hdib: HBitmap):Integer; external 'TWAIN_32.dll' name 'TWAIN_CreateDibPalette';
procedure TWAIN_DrawDibToDC(hDC: HDC;dx, dy, w, h: Integer;hDib: HBitmap;sx, sy: Integer); external 'TWAIN_32.dll' name 'TWAIN_DrawDibToDC';
procedure TWAIN_FreeNative(hDIB: HBitmap); external 'TWAIN_32.dll';
var Form1: TForm1;
implementation
{$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var dat: hBitMap; PInfo: PBitMapInfoHeader; Height, Width: integer; MyBitMap:TBitMap; {Ôóíêöèÿ âîçâåäåíèÿ 2 â ñòåïåíü s} function stp2(s: byte): longint; var m: longint; i: byte; begin m := 2; for i := 2 to s do m := m * 2; stp2 := m; end;
begin {Ïîëó÷àåì óêàçàòåëü íà ãðàôè÷åñêèå äàííûå} dat := TWAIN_AcquireNative(Handle, 0); if dat <> 0 then begin {Ïîëó÷àåì óêàçàòåëü íà îáëàñòü ïàìÿòè ñîäåðæàùåé DIB äàííûå è áëîêèðóåì îáëàñòü ïàìÿòè} PInfo := GlobalLock(dat); {Àíàëèçèðóåì ïîëó÷åííûå äàííûå} Height := PInfo.biHeight; Width := PInfo.biWidth; {Óçíàåì ðàçìåð ïîëó÷åííîãî èçîáðàæåíèÿ â ñàíòèìåòðàõ}
//Wcm.Caption := floatToStrF(100 / PInfo.biXPelsPerMeter * Width, ffNumber,8,3)+ ' cm'; //Hcm.Caption := floatToStrF(100 / PInfo.biYPelsPerMeter * Height, ffNumber,8, 3)+ ' cm'; {Îïðåäåëÿåì ÷èñëî öâåòîâ â èçîáðàæåíèè} //Colors.Caption := floatToStrF(stp2(PInfo.biBitCount), ffNumber, 8, 0) + ' öâåòîâ';
{Ðàçáëîêèðóåì ïàìÿòü} GlobalUnlock(dat); {Ïåðåäàåì â áèòîâóþ ìàòðèöó ãðàôè÷åñêèå äàííûå} {È óñòàíàâëèâàåì ïåðåõâàò îøèáîê} MyBitMap:=Image1.Picture.Bitmap; try MyBitMap.Palette := TWAIN_CreateDibPalette(dat); MyBitMap.Width := Width; MyBitMap.Height := Height; TWAIN_DrawDibToDC(MyBitMap.Canvas.Handle, 0, 0, Width, Height, dat, 0, 0); except // Îáðàáàòûâàåì íàèáîëåå âåðîÿòíóþ îøèáêó ñâÿçàííóþ // ñ íå õâàòêîé ðåñóðñîâ äëÿ çàãðóçêè èçîáðàæåíèÿ on EOutOFResources do MessageDlg('TBitMap: Håò ðåñóðñîâ äëÿ çàãðóçêè èçîáðàæåíèÿ!', mtError, [mbOk], 0); end; {Îòîáðàæàåì ãðàôè÷åñêèå äàííûå} Image1.Picture.Graphic := MyBitMap; {Îñâîáîæäàåì ïàìÿòü çàíÿòóþ ãðàôè÷åñêèìè äàííûìè} TWAIN_FreeNative(dat); end; end;
end.
-
В неправильно прочтенной статье. Exports from TWAIN_32.dll
5 exported name(s), 6 export addresse(s). Ordinal base is 1.
Sorted by Name:
RVA Ord. Hint Name
-------- ---- ---- ----
00003D81 4 0000 AboutDlgProc
00003CAA 3 0001 ChooseDlgProc
00003B35 1 0002 DSM_Entry
00003E04 6 0003 InfoHook
00003DC9 5 0004 WGDlgProc Поищи MultiTWAIN.pas
|