Closed qiaojinsong closed 11 months ago
before: LONG DTWAIN_CallDSMProc (DTWAIN_IDENTITY AppID,DTWAIN_IDENTITY SourceId,LONG lDG,LONG lDAT,LONG lMSG,LPVOID pData ); change:LONG DTWAIN_CallDSMProc (DTWAIN_SOURCE Source,LONG lDG,LONG lDAT,LONG lMSG );
Certainly! Here's a translation of your request:
"Perhaps you can provide us with this method that directly implements DTWAIN_GetSourceID and DTWAIN_GetTwainAppID."
i want to use LONG DTWAIN_CallDSMProc (DTWAIN_SOURCE Source,LONG lDG,LONG lDAT,LONG lMSG ),Can you provide it?
The return code is the same return code defined by the TWAIN standard when you are making the triplet call.
Thus you are responsible for handling the DG/DAT/MSG triplet return code -- all DTWAIN does is return this code to you.
i want to use LONG DTWAIN_CallDSMProc (DTWAIN_SOURCE Source,LONG lDG,LONG lDAT,LONG lMSG ),Can you provide it?
The call to DTWAIN_CallDSMProc requires both the app ID and the source ID. Here is the documentation.
This is a low-level TWAIN call, and you cannot make this call with missing information, as your example shows. You must have an app ID, source ID, and the data component. It isn't enough to just have the source, and DG/DAT/MSG.
"Perhaps you can provide us with this method that directly implements DTWAIN_GetSourceID and DTWAIN_GetTwainAppID."
The DTWAIN_GetSourceID() and DTWAIN_GetTwainAppID() return pointers, no different than if you called DTWAIN_SelectSource()
, with the return value from that function also being a pointer.
If your application can call DTWAIN_SelectSource
succesfully, I don't see the issue with calling similar functions that return pointers. So I cannot justify adding another function, given you have all of the pieces necessary (you still have to provide the last pointer, that will be the pointer to the data).
My development language is Node.js.
DTWAIN_SelectSource() return value is a non-zero , js can be declaration as long
DTWAIN_GetSourceID return DTWAIN_IDENTITY。 js can not declaration DTWAIN_IDENTITY
js can not declaration DTWAIN_IDENTITY
No, a DTWAIN_IDENTITY is aliased as a void
pointer, no different than the return type of DTWAIN_SelectSource
.
See the source code here.
A few lines above that line is what a DTWAIN_SOURCE is.
Note that there is a TWAIN_IDENTITY
, but that is not a TW_IDENTITY
-- instead it is a void *
.
The TW_IDENTITY is the actual struct
, while a DTWAIN_IDENTITY is an opaque pointer to that struct. Thus your js declaration for DTWAIN_GetTwainAppID
and DTWAIN_GetSourceID
return type should be no different than the one you used for DTWAIN_SelectSource
.
The DTWAIN functions for the App and Source ID knew that various computer languages couldn't handle or would have trouble with the TW_IDENTITY struct -- that's why pointers are returned, so that the client language need not have to figure out the details of the TW_IDENTITY.
Your issue is similar to this one: #75
Note that the resolution is exactly the same -- use a void *
as the return value.
If there are no further issues pertaining to the return value, I will be closing this ticket.
Hello, may I ask if it is possible to define the return value as long when using the DTWAIN_GetTwainAppID interface? And could you provide some insight into the meaning of the return codes for the DTWAIN_CallDSMProc method, such as -1 or 1?