|
Hi,
I have a great problem...
I must scan many pages from a scanner with adf.
I can set xfercount to -1, feederenabled at true and it works...
BUT
i get the TW_COMMAND.TRANSFERREADY in the message loop only when ALL images in the adf have been scanned...
I do not want this; i need to transfer ONE image a time...
get one image, view it and then continue scanning (automatically after a bit of time).
To do this i tryed to set XFERCOUNT to 1 and then (the image pass)
after transferring data, I polled for the presence of paper,
GetCapability(CAP_FEEDERLOADED) -> return TRUE...
NOW, ho to scan the next page???
I tryed to do something like this
public bool Feed()
{
TwCapability cap = new TwCapability(TW_CAP.CAP_FEEDPAGE, true);
TW_RETURNCODE rc = CapabilitySet(cap);
return (rc == TW_RETURNCODE.TWRC_SUCCESS ? true : false);
}
but it does not works and return always FAILURE...
any suggestion?
thank you in advance
Michele
p.s.
TwCapability is correctly implemented for bool... please avoid to suggest "rewrite TwCapability"...
modified on Wednesday, January 28, 2009 8:00 AM
|
|
|
|
|
c#. When i try to delete file after create with GdipSaveImageToFile. An error of file locked occurs.
I need to create file GdipSaveImageToFile and then delete it.
Any idea? Thanks
modified on Tuesday, January 27, 2009 1:12 PM
|
|
|
|
|
Hi,
I am getting the following error "Unable to load DLL 'twain_32.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)" even thought scanner is not attached to my system. I am using an applicaiton which has scanner compatibility.
Stack trace:
TargetSite : TwainLib.TwRC DSMparent(TwainLib.TwIdentity, IntPtr, TwainLib.TwDG, TwainLib.TwDAT, TwainLib.TwMSG, IntPtr ByRef)
Stack Trace : at TwainLib.Twain.DSMparent(TwIdentity origin, IntPtr zeroptr, TwDG dg, TwDAT dat, TwMSG msg, IntPtr& refptr)
at TwainLib.Twain.Init(IntPtr hwndp)
Please help!
|
|
|
|
|
in twaindefs i have the following definitions
internal enum TwCap : short
{
XferCount = 0x0001, // CAP_XFERCOUNT
ICompression = 0x0100, // ICAP_...
IPixelType = 0x0101,
IUnits = 0x0102,
IXferMech = 0x0103,
IXResolution = 0x1118,
IYResolution = 0x1119,
ISupportedSizes = 0x1122,
XScaling = 0x1124,
YScaling = 0x1125
}
internal enum TwSS : short
{ // page size
TwSS_None = 0,
TwSS_A4 = 1,
TwSS_B5Letter = 2,
TwSS_USLetter = 3
}
and in the twainlib.cs ıhave following code
TwCapability cap = new TwCapability(TwCap.ISupportedSizes, -1 ,TwType.Int16);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success)
{
CloseSrc();
return;
}
what is the problem ?
|
|
|
|
|
bottom part of aboce code
TwCapability cap = new TwCapability(TwCap.ISupportedSizes, (short)TwSS.TwSS_A4 ,TwType.Int16);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("hata page size");
return;
}
still not working..
|
|
|
|
|
I'm having the same problem, I have two scanners a Brother DSMobile600 which works when setting either TWSS_USLETTER/TWSS_USLEGAL/TWSS_BUSINESSCARD only, and I have another scanner PlusTek OpticSlim M12, that only TWSS_A4 works on it.
Does anyone have a solution for setting the SupportedSizes, and why scanners are behaving differently?
Thanks.
|
|
|
|
|
Hi,
I tried to run this example using VS2008 in Vista. I manage to call up my scanner twain setup page. But When I click on "Scan", it shows a pop up saying "scanning...".
However, there's no actual response form my scanner. Things just stop right there, with no error message.
When I use the software that comes with it, the same menu pops up, and the "scan" worls just fine.
May Anyone sggetst what is happening?
Thanks.
|
|
|
|
|
|
kengct wrote: help....~~~~
Yes I have this problem, I suffer this on my own application also...
help....~~~~
|
|
|
|
|
Check your version of registered twain.dll. Make sure it's the right one.
|
|
|
|
|
Are you trying to run this in 64bit Vista?
|
|
|
|
|
any ideas ?
VirtualVoid.NET
|
|
|
|
|
try reading through the entire posts; you'll find the answer
ASP ~ Apple Simply Performs
|
|
|
|
|
i cant find it. please help me
|
|
|
|
|
Try the 5th page or so and look for the approximate date of the thread posting on 8:43 23 Apr '06.
BTW: I found it in less than 15 seconds, but only because I clicked the 5th page thread link by accident and then saw the phrase "How to save the scanned image into a PictureBox?" as the subject of the thread posting....
otherwise, it would've taken me going page by page to find it!
So, there ya go (and any others who read this in the future...!)
GaryN
ASPX ~ Apple Simply Performs eXcellently
|
|
|
|
|
Hi,
I tryed to set the duplex capability, but the return message is always failure (I tried with 2 different scanner),
anyway the setting has no effect on the acquisition.
I checked the duplex capability, and the aswer is success.
This is my code:
TwRC rc;
rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds);
if (rc != TwRC.Success)
return;
TwCapability cap = new TwCapability(TwCap.XferCount, -1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success)
{
CloseSrc();
return;
}
TwCapability capDuplex = new TwCapability(TwCap.CAP_DUPLEXENABLED,0);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDuplex);
Is this code correct?
Do you have any suggestion?
Thank you, Serena
|
|
|
|
|
I finally solve it, The problem was the creation of the capability.
In this code the type is Int16:
public TwCapability( TwCap cap, short sval )
{
Cap = (short) cap;
ConType = (short) TwOn.One;
Handle = Twain.GlobalAlloc( 0x42, 6 );
IntPtr pv = Twain.GlobalLock( Handle );
Marshal.WriteInt16( pv, 0, (short) TwType.Int16 );
Marshal.WriteInt32( pv, 2, (int) sval );
Twain.GlobalUnlock( Handle );
}
whilst the duplexEnabled capability need the bool type.
Hope it helps someone!
Serena
|
|
|
|
|
Hello,
Could you please share your solution, too? I have a similar problem with setting the physical width and height, those values are of type TwFix32, so I need to change the TwCapability method as well to handle this type.
Thanks,
Gerhard
|
|
|
|
|
Oops, I just found out that you can't actually set physical height and width since that is the PHYSICAL height and width of the scan area.. it does make sense somehow..
But in any case it would be nice to know how to set parameters that are not of type short int.
Gerhard
|
|
|
|
|
Hi, all
How do I get TWON_RANGE values?
A sample code in C# is very helpfull.
Thank you
|
|
|
|
|
Hi, all
How to get TWON_RANGE values? A sample code in C#
is very helpfull.
Email: mqong@amcad.com
Thank you.
|
|
|
|
|
TwCapability capRange = new TwCapability(TwCap.IContrast);
capRange.ConType = (short)TwOn.DontCare;
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capRange);
if (rc == TwRC.Success)
{
switch (capRange.ConType)
{
case (short)TwOn.One:
break;
case (short)TwOn.Range:
TwRange twRange = new TwRange();
IntPtr rangePtr = GlobalLock(capRange.Handle);
Marshal.PtrToStructure(rangePtr, twRange);
GlobalUnlock(capRange.Handle);
break;
}
}
modified on Wednesday, January 19, 2011 11:31 PM
|
|
|
|
|
I have a Scanner Kodak i40, I need to scan documents with tow face...
How do I do it?
Some Idea?
|
|
|
|
|
Before GRAZIE MILLE
How setting DAT_GRAYRESPONSE ?
Ciao angelo
|
|
|
|
|
Hi there,
The program works great, except when you are trying to scan a multi-page document. That, however, is the least of my problems.
Why make the code so intense and interface-specific? Coders for this kind of thing want a single class or set of classes that provide non-interface specific answers. You code is awesome- it works but noone can understand it to mod it for themselves. Your 'tutorial' leaves much to be desired as well.
What we NEED is a class that allows the PROGRAMMER to define the inputs (resolution, density, etc) in order that we can create our own projects. Interfacing with twain should've been solved already - this is a stupid excersize that has to be done every freaking time we need to create a scanner-based application. We should be ashamed of ourselves.
There should be one class that is called programmatically, where the settings are set to a default and the programmer can create his own GUI for, in such a way that an arraylist of images is returned. Using THIS code is next to impossible - programmers are FORCED to use the twain interface and can do nothing about it - what if my program requires NO GUI? What if I need to customize the GUI? I'm talking about the TWAIN GUI here. We shouldn't need it.
Sorry to rant, but the approach seems so silly. There ought to be one method that just scans images and returns images - no GUI interfering - let US worry about interfaces.
Peace!
|
|
|
|
|