Im trying to Scan an image from a scanner connected to my device, I tried using WIA, but not all scanners support it, I found a project made on Windows forms and WPF in https://github.com/tmyroadctfig/twaindotnet
public class WpfWindowMessageHook : IWindowsMessageHook
{
HwndSource _source;
WindowInteropHelper _interopHelper;
bool _usingFilter;
public WpfWindowMessageHook(Window window)
{
_source = (HwndSource)PresentationSource.FromDependencyObject(window);
_interopHelper = new WindowInteropHelper(window);
}
public IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (FilterMessageCallback != null)
{
return FilterMessageCallback(hwnd, msg, wParam, lParam, ref handled);
}
return IntPtr.Zero;
}
public bool UseFilter
{
get
{
return _usingFilter;
}
set
{
if (!_usingFilter && value == true)
{
_source.AddHook(FilterMessage);
_usingFilter = true;
}
if (_usingFilter && value == false)
{
_source.RemoveHook(FilterMessage);
_usingFilter = false;
}
}
}
public FilterMessage FilterMessageCallback { get; set; }
public IntPtr WindowHandle { get { return _interopHelper.Handle; } }
}
the code above is used with WPF project, what i want is to use it in ASP.NET under the System.Web.Ui.Page how can I do that if its possible ?
check the link I provided for more details !
thank you !