VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234567[8]910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 17:59:58 02/22/01 Thu
Author: Michel
Subject: Re: Keeping TWAIN interface loaded
In reply to: Michael Mount 's message, "Re: Keeping TWAIN interface loaded" on 09:42:08 02/22/01 Thu


Hi Mike,

Could you email me your modified EnScan.Pas. I'll check it out from there and ensure it does not change the existing functionality.

Best regards,

Michel

>Hi Michel,
>
>I tried as you suggested and seem to have cut the per
>scan time in half. I wanted to run this by you to
>make sure I didn't do anything stupid in the process
>since I'm not 100% certain of what everything does.
>
>The BeginAcquire procedure was everything in Acquire
>up to and including ApplyOptions. I wrapped that all
>in a try..except block with the except portion calling
>EndAcquire.
>
>The other two procedures follow:
>
>procedure TScanner.AcquireWithSourceOpen( const
>AcquireEvent : TAcquireEvent;
> const
>CallBackData : LongInt );
>var
> TwainUI : TW_USERINTERFACE;
>begin
> if FTwainData.SourceID.ID = 0 then BeginAcquire;
> try
> try
> FillChar(TwainUI, SizeOf(TwainUI), 0);
> TwainUI.ShowUI := FTwainData.ShowUI;
> TwainUI.hParent := FTwainData.ParentHandle;
>
> if not CallTriplet( @FTwainData.SourceId,
>@FTwainData.AppId,
> DG_CONTROL,
>DAT_USERINTERFACE,
> MSG_ENABLEDS,
>@TwainUI, nil, FTwainData.DsmEntry) then
> raise ETwainError.Create('Unable to
>enable twain source.');
>
> ProcessImages( AcquireEvent,
> @FTwainData.SourceId,
>@FTwainData.AppId,
> FTwainData.DsmEntry,
>CallBackData);
>
> finally
> CallTriplet( @FTwainData.SourceId,
>@FTwainData.AppId,
> DG_CONTROL, DAT_USERINTERFACE,
> MSG_DISABLEDS, @TwainUI, nil,
>FTwainData.DsmEntry);
> end;
> except
> EndAcquire;
> end;
>end;
>
>procedure TScanner.EndAcquire;
>var
> TwainUI: TW_USERINTERFACE;
>begin
> try
> FillChar(TwainUI, SizeOf(TwainUI), 0);
> TwainUI.ShowUI := FTwainData.ShowUI;
> TwainUI.hParent := FTwainData.ParentHandle;
>
> CallTriplet(
> @FTwainData.SourceId, @FTwainData.AppId,
> DG_CONTROL, DAT_USERINTERFACE,
>MSG_DISABLEDS, @TwainUI,
> nil, FTwainData.DsmEntry);
>
> finally
> if FTwainData.SourceId.Id <> 0 then
> begin
> if not CallTriplet( nil,
>@FTwainData.AppId, DG_CONTROL, DAT_IDENTITY,
>MSG_CLOSEDS,
> @FTwainData.SourceId,
>nil, FTwainData.DsmEntry) then
> raise ETwainError.Create('Unable to
>close TWAIN data source');
>
> FillChar(FTwainData.SourceId,
>SizeOf(FTwainData.SourceId), 0);
> end;
> end;
>end;
>
>I think that this closes the TwainUI after each call
>to AcquireWithSourceOpen but does not actually unload
>the drivers so the reentry time is significantly
>reduced. Does this look right to you? I removed the
>EnableWindow call because I didn't want to track the
>previous value across methods. Thanks for all your
>help.
>
>- Mike
>
>>Hi Mike,
><SNIP>
>>I'll add this to the todo list. Let me know if you try
>>this out.
>>
>>Best regards,
>>
>>Michel

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.