Library not initialized
Posted: Thu Sep 02, 2010 1:20 am
I am running 32 bit version of VS 2008 on Windows 7 64 bit machine. I am still using the Vintasoft 5 sdk because I don't want to update the client until next week. When I run the software on my development machine and try to scan I get "library not initalized". The error occurs on the vsTwain1.StartDevice() line. Here is the code snippet. It worked fine prior to moving to the Windows 7 64 bit machine on a Vista 32 bit machine. I am using the net 2.0 86x vstwain.dll.
Code: Select all
vsTwain1.StartDevice();
vsTwain1.ShowUI = false;
if (vsTwain1.SelectSource())
{
vsTwain1.DisableAfterAcquire = true;
vsTwain1.MaxImages = 1;
vsTwain1.AutoCleanBuffer = true;
vsTwain1.OpenDataSource();
vsTwain1.PixelType = PixelType.BW;
if (vsTwain1.FeederPresent)
{
string dirPath = "q:\\EmployerDocuments\\" + myController.CurrentEmployer.Office + "\\";
string dateString = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00");
RelatedDocumentType rdType = (RelatedDocumentType)ScanItemTypeComboBox.SelectedItem;
string docDesc = rdType.DocumentTypeDesc;
string filePath = dirPath+myController.CurrentEmployer.EmployerId.ToString() + docDesc + dateString + ".pdf";
Int32 numOfPages = Int32.Parse(NumberOfPagesTextBox.Value.ToString());
vsTwain1.FeederEnabled = true;
vsTwain1.AutoFeed = true;
vsTwain1.XferCount = 1;
vsTwain1.PdfMultiPage = true;
if (vsTwain1.FeederLoaded)
{
vsTwain1.ShowIndicators = true;
while (vsTwain1.AcquireModal())
{
try
{
if (pictureBox1.Image != null)
{
pictureBox1.Dispose();
pictureBox1.Image = null;
}
pictureBox1.Image = vsTwain1.GetCurrentImage();
vsTwain1.SaveImage(0, filePath);
}
catch (TwainException ex)
{
if (vsTwain1.ErrorCode != Vintasoft.Twain.ErrorCode.None)
MessageBox.Show(vsTwain1.ErrorString);
else
MessageBox.Show(ex.Message);
}
}
Int32 docTypeId = Int32.Parse(rdType.DocumentTypeId.ToString());
myController.SaveScannedRecord(docTypeId, filePath, DescriptionTextBox.Text.ToString(), numOfPages);
vsTwain1.StopDevice();
MessageBox.Show("Scan completed.");
}
}
}
DescriptionTextBox.Text = string.Empty;
NumberOfPagesTextBox.Value = 1;
PopulateDocumentsGrid();
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
if (vsTwain1.ErrorCode != Vintasoft.Twain.ErrorCode.None)
MessageBox.Show(vsTwain1.ErrorString);
else
MessageBox.Show(ex.Message);
}
}