var
_Handle: HInst;
_TwainProc: TDSMEntryProc;
res : boolean;
resI : integer;
idn : TW_IDENTITY;
newS : TW_IDENTITY;
hndl : THandle;
begin
_Handle := LoadLibrary('c:\Windows\twain_32.dll');;
if (_Handle = INVALID_HANDLE_VALUE) then exit;
_TwainProc := nil;
@_TwainProc := GetProcAddress(_Handle, MakeIntResource(1));
if (@_TwainProc = nil) then exit;
idn.Id := 0;
idn.Version.MajorNum := 0;
idn.Version.MinorNum := 0;
idn.Version.Language := 0;
idn.Version.Country := 0;
idn.Version.Info := '';
idn.ProtocolMajor := 1;
idn.ProtocolMinor := 9;
idn.SupportedGroups := DG_CONTROL or DG_IMAGE;
idn.Manufacturer := '';
idn.ProductFamily := '';
idn.ProductName := '';
hndl :=
Handle;
res := _TwainProc(@idn, nil, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, @hndl) = TWRC_SUCCESS; //source manager loaded
if (not res) then exit;
newS := idn;
newS.Id := 0;
resI := _TwainProc(@idn, nil, DG_CONTROL, DAT_IDENTITY, MSG_GETFIRST, @newS);
if (resI = 0) then
ShowMessage('gut');