Home › Forums › TWAIN Classic › Is TWAIN Still alive ?
- This topic has 16 replies, 4 voices, and was last updated 17 years, 4 months ago by ff.in.twain.
- AuthorPosts
Hi all
About 10 years ago I developed a VB3.0 virtical market application that used a TWAIN interface to connect to a HP scanner from my application so it could collect an image.
I’m looking at doing something similar again and am struggling to find manufacturer info.
I’ve contacted Epson and they say the no longer support TWAIN it’s now called “Epson Scan” which just sounds like a normal printer driver to me ?? as they have no developer info.
I’ve looked on Fujitsu site and TWAIN produces no results.
What is the general ‘health’ of TWAIN and are manufacturers still supporting it as I’m struggling to find current info.
Thanks in advance for your advise
Kind Regards
Andrew
epson told you that?
Funny. I was looking at the “EPSON TWAIN Capabilities Reference Check List” this morning – the one that I downloaded from from their dev portal ( http://www.epsondevelopers.com ). And while they don’t have the best twain implementation its not the worst either.And the Epson 3490 I would rather have not purchased last week says “Twain” right on it…
Fujitsu …. yeah i dunno.
but it seems alive to me. weak, but alive.
Thanks gabe
Will check out the site 🙂
are you still working in vb3?
Ah those were the days 🙂
No for this particular application I am using a veryical market language called Visual Dataflex 11.1
It allows the import of ActiveX controls and I’ve had a look at a couple but not had much luck yet
I’ve tried calling the DSM_Entry direct from a test app but at the moment it is just crashing …..
The language has an External_Function command that looks like this
External_Function DSM_Entry “DSM_Entry” twain_32.dll pointer pOrigin uinteger DG uShort DAT uShort MSG pointer pData Returns ushort
I’ve defined some structure to handle the twain data types …
struct TW_INT8
char TW_Value
end_struct
struct TW_INT16
short TW_Value
end_struct
struct TW_INT32
integer TW_Value
end_struct
struct TW_UINT8
uChar TW_Value
end_struct
struct TW_UINT16
ushort TW_Value
end_struct
struct TW_UINT32
uinteger TW_Value
end_struct
struct TW_BOOL
ushort TW_Value
end_struct
struct TW_FIX32
TW_INT16 Whole
TW_UINT32 Frac
end_struct
struct TW_STR32
UChar[34] TW_Value
end_struct
struct TW_STR64
uChar[66] TW_Value
end_struct
struct TW_STR128
uChar[130] TW_Value
end_struct
struct TW_STR255
uChar[256] TW_Value
end_struct
struct TW_STR1024
uChar[1026] TW_Value
end_struct
struct TW_UNI512
uChar[1024] TW_Value // whar_t type so two bytes per character.
end_struct
struct TW_VERSION
TW_UINT16 MajorNum
TW_UINT16 MinorNum
TW_UINT16 Language
TW_UINT16 Country
TW_STR32 Info
end_struct
struct TW_IDENTITY
TW_UINT32 Id
TW_VERSION Version
TW_UINT16 ProtocolMajor
TW_UINT16 ProtocolMinor
TW_UINT32 SupportedGroups
TW_STR32 Manufacturer
TW_STR32 ProductFamily
TW_STR32 ProductName
end_struct
…. and these constants
#replace DG_CONTROL |CI$0001
#replace DG_IMAGE |CI$0002
#replace DG_AUDIO |CI$0004
#replace DAT_PARENT |CI$0004
#replace MSG_OPENDSM |CI$0301
#replace MSG_CLOSEDSM |CI$0302
#replace TWLG_ENG 2
#replace TWLG_USA 13
#replace TWCY_UNITEDKINGDOM 44
#replace TWON_PROTOCOLMINOR 8
#replace TWON_PROTOCOLMAJOR 1… my test procedure then ….
procedure Test
TW_IDENTITY AppID
string sVer sManu sFamily sName
integer iLoop i1 i2
ushort Result
handle hWnd
move 0 to AppID.Id.TW_Value
move 1 to AppID.Version.MajorNum.TW_Value
move 2 to AppID.Version.MinorNum.TW_Value
move TWLG_ENG to AppID.Version.Language.TW_Value
move TWCY_UNITEDKINGDOM to AppID.Version.Country.TW_Value
move “My App Version” to sVer
for iLoop from 1 to (length(sVer))
move (ascii(mid(sVer,1,iLoop))) to AppID.Version.Info.TW_Value[iLoop-1]
Loop
move 0 to AppID.Version.Info.TW_Value[length(sVer)]
move TWON_PROTOCOLMAJOR to AppID.ProtocolMajor.TW_Value
move TWON_PROTOCOLMINOR to AppID.ProtocolMinor.TW_Value
move (DG_IMAGE ior DG_CONTROL) to AppID.SupportedGroups.TW_Value
move “App’s Manufacturer” to sManu
for iLoop from 1 to (length(sManu))
move (ascii(mid(sManu,1,iLoop))) to AppID.Manufacturer.TW_Value[iLoop-1]
Loop
move 0 to AppID.Manufacturer.TW_Value[length(sManu)]
move “App’s Product Family” to sFamily
for iLoop from 1 to (length(sFamily))
move (ascii(mid(sFamily,1,iLoop))) to AppID.ProductFamily.TW_Value[iLoop-1]
Loop
move 0 to AppID.ProductFamily.TW_Value[length(sFamily)]
move “App’s Product Name” to sName
for iLoop from 1 to (length(sName))
move (ascii(mid(sName,1,iLoop))) to AppID.ProductName.TW_Value[iLoop-1]
Loop
move 0 to AppID.ProductName.TW_Value[length(sName)]
get window_handle of myPanel to hWnd
move (DSM_Entry((addressof(AppID)),0,DG_CONTROL,DAT_PARENT,MSG_OPENDSM,(addressof(hwnd)))) to Result
end_procedureBut as I say it is still locking. I’m sure it’s just because I dont have one of the constants or structures correct. C an you give me any clues ?
i havent checked your defs but for the final call, i wonder about a few things,
if 0 is going to work in place of NULL for the second parameter.
try taking out the first addressof – the one before AppIdthe datatype for your openDsm constant ought to be ushort – maybe it already is I cant tell.
just before you place the call into twain, there is this:
get window_handle of myPanel to hWnd
does that mean that your hWnd variable hold the handle to your application?Gabe
I’ve put my answers to your questions below starting with >
Thanks again for your help
Kind Regards
Andrew
PS Are the structures in the TWAIN_32.DLL 1 byte aligned ? just a thoughht although it might be a red herring ! 🙂
i havent checked your defs but for the final call, i wonder about a few things,
> OK
if 0 is going to work in place of NULL for the second parameter.
> The language does not have a NULL ‘value’ so I don’t think I can do anything else
try taking out the first addressof – the one before AppId
> Why? The spec says this requires a pointer to the TW_IDENTITY structure as it needs to write back to it ?
the datatype for your openDsm constant ought to be ushort – maybe it already is I cant tell.
> I don’t think the constants in the language I’m using can have a ‘type’
just before you place the call into twain, there is this:
get window_handle of myPanel to hWnd
does that mean that your hWnd variable hold the handle to your application?> hWnd will hold the windows window handle for the applications main window
why would i suggest trying to take out the first address of…
becasue in my code i don’t pass a pointer to that structure, i pass the entire structure. might work, might not.I asked about the hWnd because in my ignorance of the languague you’re using it seemed that
get window_handle of myPanel to hWnd
would place the handle into the variable, but then i didnt understand what you’re second addresof does, and if get window_handle produced the handle, i was going to recommend removing the second addressof.and thats about where i run out of usefulness.
gabe
Thanks for all your help …. I did not wish to come across as ungrateful just ‘passing the ball back’ and asking the reason for your suggestions
addressof(x) just get the memory address where x is stored
I’ve given them a quick go but still no luck
I think I’ve probably reached a dead end and will have to look again at the ActiveX route which I did not have much sucess with initally.
Can you recommend and good well documented TWAIN ActiveX controls
Thanks again gabe 🙂
Cheers
Andrew
dosadi have several products, some free some not, I used their classic (free) library a few years back and was pleased – plus they seem to be awefully good about answering questions quickly.
Cheers gabe i’ll check em out 😀
Hi,
I’m writing a win32C++ twain application to operate EPSON 10000XL flatbed scanner. I have been able to open and scan images successfully. But I’m struggling to change the capabilities.
Specillay I want to set the following two boolean capabilities to TRUE.
ICAP_AUTOMATICBORDERDETECTION
ICAP_AUTOMATICROTATEI tried it in the following manner.
– Load the TWAIN DLL and collect DSM Entry Proc.
– Send triplet (DG_CONTROL,DAT_PARENT,MSG_OPENDSM):
received success.– Send triplet (DG_CONTROL,DAT_IDENTITY,MSG_USERSELECT):
received success. Selected 10000XL.– Send triplet (DG_CONTROL,DAT_IDENTITY,MSG_OPENDS):
received success.– Send triplet (DG_CONTROL,DAT_CAPABILITY,MSG_SET):
twCapability.Cap = CAP_XFERCOUNT;
twCapability.ConType = TWON_ONEVALUE;
value is set to 1
received success.– Send triplet (DG_CONTROL,DAT_CAPABILITY,MSG_SET):
twCapability.Cap = ICAP_UNDEFINEDIMAGESIZE;
twCapability.ConType = TWON_ONEVALUE;
value is set to TRUE (1)
received failure– Send triplet (DG_CONTROL,DAT_CAPABILITY,MSG_SET):
twCapability.Cap = ICAP_AUTOMATICBORDERDETECTION;
twCapability.ConType = TWON_ONEVALUE;
value is set to TRUE (1)
received failurePlease help me to find out what causes my last two calls to fail. Specifiacally I’m concerned about EPSON 10000XL. Has anyone worked with that scanner using twain?? I wonder whether the twain interface is properly implemented for EPSON 10000XL.
Thanking you in advance.
Best Regards,
FF
I don’t have experience with that particualr model, but in general the epson twain support is lacking (crippled?).
are you are to set those last two caps with the twain toolkit?
Hi Gabe,
Thanks a lot for your response. Sad to hear about poor Epson twain support.
Epson toolkit is something I haven’t used. Is it some develoer SDK type toolkit?? What I did was to use twain in the standard way (as per twain spec 1.9) and write win32 C++ code. I only access twain32.dll for all my work via the DSMProc (as explained in the spec).
Please let me know whether I’m trying some impossible thing by trying to implement win32 C++ code as per twain interface. If so I can give it up and choose some other alternative.
Cheers
no, you’re doing the possible. you’ll suffer epson’s poor twain implementation but I’ve been able to get espon’s to do what i need with just the twain dll.
the toolkit I’m talking about is the twain toolkit (not from epson) that you can find (somewhere… I don’t have the link on me right now) on this site. take a look in the forumn here, search for “Twain toolkit” – its a sample C (might be C++, but to me it reads like C) app with source. Most useful bit of code ever for testing your apps against a known source.
try to set those two caps with the toolkit, and let me know the results – I had some code (…where did I put that darn code…) to enumerate over the standard twain triplets and show you what calls the device said that it supported… well – I’ll look for the code you look for the toolkit. first one back here wins.
gabe
- AuthorPosts