The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Java Tech: Acquire Images with TWAIN and SANE, Part 2
Subject:  Setting other ICAP properties in scanner...
Date:  2005-05-25 22:02:50
From:  javajeff
Response to: Setting other ICAP properties in scanner...


I would suggest replacing the memcpy() call with a simple assignment:

pTWOneValue->Item = (TW_UINT32) &Frame;

I recommend this approach because TW_FRAME contains four 32-bit fields and TW_ONEVALUE's Item field is only 32 bits. I believe the TWAIN implementers are looking for the address of a structure in this field.

If you still have a problem, it could be that Frame is a local variable. I can't remember off the top of my head but I think TWAIN might require you to dynamically allocate memory for Frame and assign that memory's address to Item. But try passing the address of the local Frame variable first.

By the way, I believe you can discard the "+ sizeof(TW_FRAME)" from the following line:

cap.hContainer = GlobalAlloc(GHND,(sizeof(TW_ONEVALUE)+sizeof(TW_FRAME)));

Good luck.

Jeff

 Feed java.net RSS Feeds