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 |