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 : Tuesday, August 9, 2005 3:45:35 AM(UTC)

rmajew  
rmajew

Groups: Registered
Posts: 2


I'm trying to evaluate the twain functions.  We have a requirement to add twain functionality to a PowerBuilder program and so far I'm having no luck.

I first tried using calls to the API but was getting an error 13 when trying to initialize the device.  I left a message here but so far no one has responded.  A left one in a PowerBuilder forum and got replies but they pretty much told me not to use the API but to use the ActiveX control instead.  Several people have had quite a bit of success using the ActiveX control.  The problem is that the ActiveX control for twain was removed.

Now, I understand how to program API calls and I understand how to program ActiveX calls but my understanding of COM is limited to knowing that it stands for Component Object Model.  I've been digging in the LeadTools documentation and the PowerBuilder documentation trying to link the two together but it seems like the more I dig the bigger the hole I'm getting into.  If I can get it to work we're going to purchase the tools but If I can't we're going to have to look elsewhere.  Can anyone help?

 

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, August 10, 2005 6:27:38 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Hello,

We currently do not have someone
on staff who is familiar with how COM works in PowerBuilder. However, I can provide you with some pointers that may help:

1. ActiveX and COM are basically
the same technology in LEADTOOLS. Our ActiveX is the old interface. COM
is the newer interface (and it has some additional features in high end toolkits).
2. The difference is generally ActiveX were usually dropped on a form and the creation was handled by the environment.
3.
The usual way to create the COM objects is with a CreateObject call.
PowerBuilder should have something similar that allow the creation of COM objects.

Thanks,
Maen Badwan
LEADTOOLS Technical Support

 
#3 Posted : Monday, October 3, 2005 5:58:08 PM(UTC)
robpassam

Groups: Registered
Posts: 1


You will need to use the ConnectToNewObject method in PB using the ProgID of the LEAD RatserTWAIN_D object library component. The prog ID can be found using the PB ObjectBrowser and looking under the OLE tab and then in the Programmable Objects list for LEAD RatserTWAIN_D object library (14.
0)

 

PB Example (for open event of a window to select TWAIN source):

OLEObject   ole_twain

Long   ll_hWin

ll_hWin = Handle(this)

ole_twain = Create OLEObject

li_rtn = ole_twain.ConnectToNewObject(<ProgID>)

ole_twain.IniSession(ll_hWin)

ole_twain.SelectSource()

Note:

Only Functions and properties can be accessed (This method in PB does not support OLE Event handling unlike VB's DIM WitEvent command). I was  therefore unable to find a way to use the will Acquire method of the Com object (which uses AcquirePageEvent event to obatin a pointer to the scanned bitmap) and instead had to settle for using the AcquireMulti method and loading the scanned image from file.

  

 

 

 

 

 

 

 

 

 
#4 Posted : Tuesday, January 24, 2006 7:31:37 AM(UTC)

tcruse  
tcruse

Groups: Registered
Posts: 1


Using PB 10.2 - I agree with all you have said, however, I am having an issue with AquireMulti, Here is my code, is there something obviously wrong?

oleObject RasterTwain

long XferMode, ret_val, hdl, TwainSourceCnt, flags

hdl = handle( w_split )
string file_name = "C:\tyler.tif"

FileDelete( file_name )
RasterTwain = create oleobject

ret_val = RasterTwain.ConnectToNewObject("LEADRasterTwain_D.LEADRasterTwain_D.140")
if ret_val < 0 THEN
 MessageBox( "Application Error " + string( ret_val) , "Can not connect to Lead Tools RasterTwain 14" )
 active_flag = FALSE
 return
end if

RasterTwain.ManName = "Trellix Engineering"
RasterTwain.ProdFamily = "Medteam"
RasterTwain.Version = gst_var.cur_appl_version
RasterTwain.AppName = AppName()

RasterTwain.InitSession( hdl )

TwainSourceCnt = RasterTwain.SourceCount
if TwainSourceCnt < 1 then
 MessageBox( "Twain Scanner Error", "No TWAIN Scanners Found" )
 TwainCap.DisconnectObject()
 RasterTwain.DisconnectObject()
 destroy TwainCap
 destroy RasterTwain
 return
end if

if gst_var.Select_Scanner = TRUE  THEN
  RasterTwain.SelectSource()
else
// RasterTwain.SelectSource()
end if

RasterTwain.FastTransferMode = 2       // L_LTWAIN_BUFFER_MODE
RasterTwain.FastFormat = 3          //FILE_TIF
RasterTwain.FastBitsPerPixel = 1
RasterTwain.FastBufferSize = 0
RasterTwain.FastUsePreferredBufferSize = TRUE

RasterTwain.EnableAcquireMultiEvent = FALSE

messagebox( "Ready AquireMulti", "ret_val = " + string( ret_val ) )

ret_val = RasterTwain.AcquireMulti( "C:\tyler.tif" , 3, 1 )


TwainCap.DisconnectObject()
RasterTwain.DisconnectObject()
destroy TwainCap
destroy RasterTwain

Everything seems OK up until the AcquireMulti call where I get a generic error calling AquireMulti at line xxxxx

 
#5 Posted : Thursday, January 26, 2006 5:14:13 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

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

The AcquireMulti method is part of LEADTOOLS Document Imaging. This
means if you have LEADTOOLS Raster Imaging or Raster Imaging Pro, it will not work.

In the evaluation editions of LEADTOOLS, all optional features,
including Document, are unlocked, so AcquireMulti should work in the
Eval.
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#6 Posted : Thursday, March 30, 2006 1:47:25 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

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

Our engineers added new properties to RasterTwain COM object to implement feature request 4254AMN as follows:
* SaveAcquiredBitmap property: enable or disable saving bitmaps to the following 2 properties.
* AcquiredBitmap property: returns the last acquired bitmap.
* AcquiredBitmapList property: returns list of acquired bitmaps


If SaveAcquiredBitmap is set to TRUE, the acquired bitmap(s) will be
save to above 2 new properties, otherwise the acquired bitmap(s) will be returned into the event.
Note: the default value for SaveAcquiredBitmap property is FALSE.


The new features are available to owners of LEADTOOLS 14.5 in the latest service pack, which can be downloaded from out support site.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
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.318 seconds.