StackOverFlow Exception
Posted: Wed Oct 15, 2008 7:21 pm
private void ScanButton_Click(object sender, EventArgs e)
{
try
{
vsTwain1.StartDevice();
vsTwain1.ShowUI = false;
if (vsTwain1.SelectSource())
{
vsTwain1.DisableAfterAcquire = true;
vsTwain1.MaxImages = 1;
vsTwain1.AutoCleanBuffer = true;
vsTwain1.OpenDataSource();
if (vsTwain1.FeederPresent)
{
vsTwain1.FeederEnabled = true;
vsTwain1.AutoFeed = true;
vsTwain1.XferCount = -1;
if (vsTwain1.FeederLoaded)
{
while (vsTwain1.AcquireModal())
{
try
{
vsTwain1.SaveImage(0, "c:\test.tiff");
}
catch (TwainException ex)
{
MessageBox.Show(ex.Message);
}
}
vsTwain1.StopDevice();
}
MessageBox.Show("Scan completed.");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I get a stackoverflow exception on the AcquireModal() function call. The scanning progress indicatior starts moving and then I get the exception.
Bill
{
try
{
vsTwain1.StartDevice();
vsTwain1.ShowUI = false;
if (vsTwain1.SelectSource())
{
vsTwain1.DisableAfterAcquire = true;
vsTwain1.MaxImages = 1;
vsTwain1.AutoCleanBuffer = true;
vsTwain1.OpenDataSource();
if (vsTwain1.FeederPresent)
{
vsTwain1.FeederEnabled = true;
vsTwain1.AutoFeed = true;
vsTwain1.XferCount = -1;
if (vsTwain1.FeederLoaded)
{
while (vsTwain1.AcquireModal())
{
try
{
vsTwain1.SaveImage(0, "c:\test.tiff");
}
catch (TwainException ex)
{
MessageBox.Show(ex.Message);
}
}
vsTwain1.StopDevice();
}
MessageBox.Show("Scan completed.");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I get a stackoverflow exception on the AcquireModal() function call. The scanning progress indicatior starts moving and then I get the exception.
Bill