Home › Forums › TWAIN Classic › How to detect DF_DSM2 flag correctly?
- This topic has 1 reply, 1 voice, and was last updated 9 years, 7 months ago by Michael.
- AuthorPosts
Hi, everyone!
I defined DF_ flags in accordance with “twain.h” file:
#define DF_DSM2 0x10000000L
#define DF_APP2 0x20000000L
#define DF_DS2 0x40000000LIt means that all these flas reside in the high byte of 32bit TW_IDENTITY.SupportedGroups field.
Then I initialized TW_IDENTITY.SupportedGroups as “DF_APP2 | DG_CONTROL | DG_IMAGE” which in binary is “0010 0000 0000 0000 0000 0000 0000 0011”. That’s OK so far.
After executing of “DG_CONTROL, DAT_PARENT, MSG_OPENDSM” the TW_IDENTITY.SupportedGroups is “0010 0000 0000 0001 0000 0000 0000 0011”.
That is DSM set a bit but it doesn’t look like DF_DSM2. What’s wrong? Is something wrong with data alignment in my TW_IDENTITY structure? Or DSM allways
set bit in a middle of 32bit value?I would appreciate any help.
Yes! It was C++ structure data alignment!
I used “#pragma pack(push, 2)” and found DF_DSM2 flag in its correct place.
But i’m stilll confused. Does DSM receive pointer to application’s TW_IDENTITY structure and then use fixed byte offset to find SupportedGroups field? Weird…
Anyway, “all-clear”! Thanks.
- AuthorPosts