twain / twain-cs

A C# interface for TWAIN
168 stars 67 forks source link

can't get capabilities; what can i get out of a_szMemref? [sf#3] #7

Closed kolomiets closed 7 years ago

kolomiets commented 7 years ago

Reported by ad-viper on 2014-08-01 15:20 UTC Hi Mark,

i've tried to run your sample "twaincsscan.exe" and to scan with it a document, but it's not running. I can't set the options - i'm only able to set a save directory and when i press "scan" the spezific scan-window of the data source is popping up and the whole programm freezes. I didn't realized that not even the sample is running... Can you please give me some advice how to make it running?

I've tried to implement some scan functions but failed because i don't have a clue how to get the capabilities and how to handle the alrounder "a_szMemref".

  1. Problem:

Every Get request regarding Capabilities returns something like TW12314 <- "TW" + random number - i'm pretty sure it's an adress. How should i handle this?

  1. Problem:

How do i get my Picture out of a_szMemref - is it an adress - if yes: how do i convert it into an Int pointer? If this isn't possible then what should i do to get my picture out of it?

a_szMemref = "0,0"; sts = twToolKit.Send("DG_CONTROL", "DAT_USERINTERFACE", "MSG_ENABLEDS", ref a_szMemref, ref status);

Best regards

DonkyKong

kolomiets commented 7 years ago

Commented by mlmcl on 2014-10-13 15:41 UTC Hi DK...

Wow, sorry about the delay. I was watching for tickets, but for some reason they've not been showing up.

Assuming this is still useful to you (and it may not be), I'm uploading a new version of the code later today.

When it comes to using the system, I recommend performing the desired steps using the diagnostic tool, since this shows the mapping of the TWAIN structures to the CSV strings.

If you use the Toolkit, then you need to provide a ReportImage callback function to get access to the image data. If you decide to implement this without the Toolkit, then I recommend looking at the Toolkit to see how things are done. It's complex enough that it made sense to me to provide code with the system.

As for TW_12314, that looks to me like a custom value that's not supported in the TWAINH.CS tables. I'd like to add custom support to the kit, but that's going to need a bit of work. In the mean time the system does support the use of numeric values in the CSV to get around the problem. That said 12314 looks more like a decimal value (the output might have an issue). Check your driver to see what 0x301A maps to.

-- Mark

kolomiets commented 7 years ago

Updated by mlmcl on 2014-10-13 15:42 UTC

kolomiets commented 7 years ago

Commented by mlmcl on 2014-10-19 15:30 UTC Fixed in 2.3.0.5.

I believe I have the freeze problem addressed. Window messages were not being properly handled for drivers that have their GUI running in the same thread as the applications window (the one passed into HINSTANCE in DllMain). I've confirmed the fix with a driver that exhibited the problem, so I'm marking this one as closed.

kolomiets commented 7 years ago

Updated by mlmcl on 2014-10-19 15:30 UTC