Forum Replies Created
- AuthorPosts
Thanks again gabe 🙂
Cheers gabe i’ll check em out 😀
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
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
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 ?
Thanks gabe
Will check out the site 🙂
- AuthorPosts