Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, May 10, 2006 1:42:21 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


I want to acquire image using TWAIN in L_TWAIN_FILE_MODE.

I am using VisualBasic 6 with LT14.

May I get any sample code to do so with the definitions of -

L_TwainSetProperties, LTWAINPROPERTIES, DATATRANSFER, L_TwainInitSession,

L_TwainAcquire

FOR VISUAL BASIC 6 LT 14

Please reply soon.  The user needs are urgent.

Thanks in advance.

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, May 10, 2006 6:21:07 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


I am using LT14.

Waiting for reply.  Thanks again

 
#3 Posted : Thursday, May 11, 2006 8:23:52 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Amit,
You can tell by setting the ICAP_XFERMECH capability value to TWSX_FILE and checking the result.

The Twain API help file shows how to set this capability using the L_TwainSetCapability method. The code sample is in the help topic for the L_TwainAcquire function.

The definitions you ask about are all in the L_OCXADD.BAS file, which is in the LEADTOOLS\Include folder. We currently have VB6 samples and demos that use the Twain COM object. If you want to use the DLL API, you can convert the C samples to VB.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#4 Posted : Friday, May 12, 2006 5:30:48 AM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


HI Amin,

Thanks for your reply.

I had tried same things with LEADRasterTwain object.  The sample code is as follows.

I am using VB6 with LT 14.  I want to capture image in FILE mode

For writing following code, I referred "Acquiring an Image (Visual Basic)" example from LTTWNCOMN.hlp help file.  Code for initializing device is not included bellow, because it is working fine.

'--------------CODE-----------------------------

Private Sub Acquire_Click()
    Dim lRasterVariant As New LEADRasterVariant
    lRasterVariant.Type = VALUE_ARRAY_LONG
    lRasterVariant.LongItemValue(0) = L_TWSX_FILE
   
    TwainCap.EnableMethodErrors = True
    TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
    TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
    TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
    TwainCap.CapOneValue.OneValCapValue = lRasterVariant 'Error at this statement
    
    RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET
   
    RasterTwain.FileTransferName = "c:\twain.bmp"
   
    RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE
End Sub

'Err.Description :- Method 'OneValCapValue' of object 'ICapabilityOneValue2' failed
'Err.Number :- 20013

'-------------END-CODE-----------------------------

My request is,

- Copy this code in your project

- Resolve the error

- Check for the output whether the file get captured at c:\ (or path you specify.), and send me the updated code back.

Please send the updated code with helpful comments clearifying the use of property and method.

Thanks again.

Waiting for reply.

 
#5 Posted : Sunday, May 14, 2006 10:26:58 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Amit,
As shown in the help topic "Capability Example for Visual Basic", when setting this capability, you should do the following instead of using VALUE_ARRAY_LONG:
lRasterVariant.Type = VALUE_USHORT
lRasterVariant.LongValue = L_TWSX_FILE

Please try this and if you still face a problem, tell me if the error changes value and position.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#6 Posted : Sunday, May 14, 2006 9:40:23 PM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


'-------------------------------CODE-------------------------------------------
Private Sub Acquire_Click()
    Dim lRasterVariant As New LEADRasterVariant
    lRasterVariant.Type = VALUE_USHORT
    lRasterVariant.LongValue = L_TWSX_FILE
   
    TwainCap.EnableMethodErrors = True
    TwainCap.CapInfo.Capability = L_ICAP_XFERMECH
    TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
    TwainCap.CapOneValue.OneValItemType = L_TWTY_INT16
    TwainCap.CapOneValue.OneValCapValue = lRasterVariant
    RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET
   
    RasterTwain.FileTransferName = "c:\twain.bmp"
  
    RasterTwain.Acquire L_LTWAIN_SHOW_USER_INTERFACE
End Sub
'-------------------------------CODE-------------------------------------------
1)
If I set TwainCap.EnableMethodErrors = True then following error occer at line

TwainCap.CapOneValue.OneValCapValue = lRasterVariant


Method 'OneValCapValue' of object 'ICapabilityOneValue2' failed
20013

2)
If I set TwainCap.EnableMethodErrors = False then following error occer at line

RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET

LEAD Error : General Failure
20000

3)

One more error occer some time for same line

If I set TwainCap.EnableMethodErrors = False then following error occer at line some times

RasterTwain.SetCapability2 TwainCap, L_LTWAIN_CAPABILITY_SET

LEAD Error : TWAIN Bad Value Passed

20568

 

I am using Visual Basic 6 with LEAD Tools 14.  LEAD Patch I am using is '4 Jan'.  My twain device supports file mode.  It is confirmed with other softwares.  You may use "Twain 32 Sample Source" from twack32 (TwainToolKit) or any other source.

I am attaching sample project for you.  Please make corrections it that project, test it at your end. and give me the final project.

I need to finish this task as soon as possible.  As I told in my first mail, the customer needs are urgent.  So forward back as soon as possible.  And this time, give final solution please.

Waiting for your reply.

File Attachment(s):
SampleProject.zip (3kb) downloaded 35 time(s).
 
#7 Posted : Tuesday, May 16, 2006 12:04:03 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Amit,
I changed the following line in your project:
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16 'instead of L_TWTY_INT16

I tested with build 14.5.0.10 (now available in the latest patches) using the TWAIN_32 Sample Source and it's working.

I also made another change by adding the If statement in the following Sub:
Private Sub RasterTwain_AcquirePageEvent(ByVal pBitmap As Long)
    MsgBox "Acquisition of Image Done"
    If 0 = pBitmap Then Exit Sub
    LEADRasterView1.Raster.InsertBitmapListItem -1, pBitmap
End Sub
The reason is that the event can be triggered without a valid bitmap if it was saved to file because of using the File mode.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#8 Posted : Tuesday, May 16, 2006 8:05:22 PM(UTC)

Amit  
Amit

Groups: Registered
Posts: 101


Thousands of thanks Amin,

The solution you have given is working file.

Thanks and will see you for my next problem.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.087 seconds.