I am using the twain library for scanner, and the application lists some devices that when selecting does not work, so I debugged and saw that it does not throw the exception that I treated, but it freezes in that code
public void Acquire()
{
TwRC rc;
CloseSrc();
if (appid.Id == IntPtr.Zero)
{
Init(hwnd);
if (appid.Id == IntPtr.Zero)
return;
}
try
{
//CONGELA NESSE BLOCO ABAIXO E NÂO LANÇA EXCEPTION
rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds);
}
catch(Exception ex)
{
throw new ScannerException("Não foi possivel digitalizar, verifique o driver selecionado!");
}
TwCapability cap = new TwCapability(TwCap.XferCount, 1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success)
{
CloseSrc();
throw new ScannerErroDigitalizarException("Erro ao carregar driver selecionado. Verifique se o driver pertence a um Scanner.");
}
TwUserInterface guif = new TwUserInterface();
guif.ShowUI = 1;
guif.ModalUI = 1;
guif.ParentHand = hwnd;
rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.EnableDS, guif);
if (rc != TwRC.Success)
{
CloseSrc();
throw new ScannerErroDigitalizarException("Erro ao carregar driver selecionado. Verifique se o driver pertence a um Scanner.");
}
}
How to treat the same?
Reference: link