Home › Forums › TWAIN Classic › Getting Twain command null on Vista Home Basic…
- This topic has 0 replies, 1 voice, and was last updated 14 years, 9 months ago by madangopals.
- AuthorPosts
Hi Guys,
I am a software engg. working with Chetu Inc.
I have developed one scanner application using the twain_32.dll api and developed it in the c#, .NET framework version 3.5. My application works fine to scan document from scanner flatbed or feeder when i used windows xp operating system with scanner/printer hp 3050 series or with dell scanner/printer 2335dn MFP.I am facing one issue when i deployed my windows desktop scanner application on the vista home basic and try to scan document from the dell 2335dn MFP scanner.
Its not working for the feeder option of scanner and scan only one document from feeder if still there are multiple documents available on the feeder.
Follwing is the code section which i am trying to use to transfer scan image from scanner device to memory:
ArrayList pics = new ArrayList();
if (srcds.Id == IntPtr.Zero)
return pics;TwRC rc;
IntPtr hbitmap = IntPtr.Zero;
TwPendingXfers pxfr = new TwPendingXfers();do
{
pxfr.Count = 0;
hbitmap = IntPtr.Zero;TwImageInfo iinf = new TwImageInfo();
rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageInfo, TwMSG.Get, iinf);
// rc = DSiinf(appid, srcds, TwDG.Image, TwDAT.ImageLayout, TwMSG.Set, iinf);
if (rc != TwRC.Success)
{
CloseSrc();
return pics;
}
//This external method call is used to transfer the data from
//the data source to bitmap.
//rc = DSixfer( appid, srcds, TwDG.Image, TwDAT.ImageNativeXfer,
//TwMSG.Get, ref hbitmap );
rc = DSixfer(appid, srcds, TwDG.Image, TwDAT.ImageNativeXfer,
TwMSG.Get, ref hbitmap);if (rc != TwRC.XferDone)
{
CloseSrc();
return pics;
}
//Preparing for the multiple image transer. it returns the DAT_PendingXfers.count
//and transitions the session to state 6 (Transfer Ready)
// if the count of pending transfer is nonzero, or to state 5(Source Enabled) if
//the count is zero.
rc = DSpxfer(appid, srcds, TwDG.Control, TwDAT.PendingXfers,
TwMSG.EndXfer, pxfr);
if (rc != TwRC.Success)
{
CloseSrc();
return pics;
}pics.Add(hbitmap);
}
while (pxfr.Count != 0);
//Check if the there are any pending image data need to transfered.//This external call of the method is used to reset the pending
//transfer of data.
rc = DSpxfer(appid, srcds, TwDG.Control, TwDAT.PendingXfers,
TwMSG.Reset, pxfr);
return pics;see the following definitions for reference.
Basically i am not getting the value for pxfr variable and it is not updated for the next image data transfer.
[DllImport(“twain_32.dll”, EntryPoint=”#1″)]
private static extern TwRC DSpxfer( [In, Out] TwIdentity origin,
[In] TwIdentity dest, TwDG dg, TwDAT dat,
TwMSG msg, [In, Out] TwPendingXfers pxfr );[StructLayout(LayoutKind.Sequential, Pack=2)]
internal class TwPendingXfers
{ // TW_PENDINGXFERS
public short Count;
public int EOJ;
}Please help me if anyone have any idea.
Thanks
Madan Gopal Soni- AuthorPosts