Home › Forums › TWAIN Classic › Is TWAIN Still alive ? › Reply To: Is TWAIN Still alive ?
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_procedure
But 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 ?