1

in my application i want to scan the image through scanner in uwp application. so i am refere the scan code which is done using wpf with twain dll. so i am trying to use the same code in uwp. but it not applicable.

problem is when i am trying to use WinFormsWindowMessageHook it gives error cant convert uwp to winform.

using windows.winform;
using TwainDotNet; 

var dd = new Twain(new WinFormsWindowMessageHook(this));
  • WinForms and WPF are completely different APIs than UWP. – Jason Apr 16 '19 at 14:32
  • thank you for your valuable reply. :) i dont want to use the ScanFilesToFolderAsync is their any other way to scan an image through scanner. any third party dll which is free ? –  Apr 16 '19 at 14:35
  • @ketan what's the problem for you to use UWP API directly? Is there any problem or specific reason that UWP API cannot meet your requirement? – Barry Wang Apr 17 '19 at 04:46
  • is it possible to use TwainDotNet dll for scan purpose in uwp ?ScanFilesToFolderAsync(scan methods or classes which is inbuilt declared in uwp ) support for WIA and TWAIN scanners ? if it support then i will use inbuilt classes which is provide by the UWP happily. –  Apr 17 '19 at 05:18
  • @Barry Wang : any idea ? :( –  Apr 17 '19 at 06:31
  • 1
    @ketan Nope. You cannot use a general desktop dll on UWP platform since UWP requireds WinRT. They have different architectures. So please check whether this api works for your device first: https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/scan-from-your-app And if not, you may need to ask the support of WIA and TWAIN scanners to see whether they can provide winrt libraries for you to use in UWP platform. – Barry Wang Apr 17 '19 at 06:49
  • @Barry thnak you for your replay [link](https://stackoverflow.com/q/55686040/11362349) because of this problem i am moved to twain dll or third party dll. do you have any idea why this code is not working on my machine ? –  Apr 17 '19 at 07:21
  • @ketan After reading your another post I still cannot be sure about the reasons and I don't have a device to test your issue. Can you open your event viewer->Application and Services logs->Microsoft->Windows->Apps->Microsoft Windows-TWinUI/Operational and see if there is any error info that is related to your app which is related to scanner error? – Barry Wang Apr 18 '19 at 04:40
  • @BarryWang-MSFT Thnak you for your time and interest :) finally issue solved. after reinstalling scanner drivers issue solved now it works. :) once again Thank You :) Have a great day :) –  Apr 18 '19 at 13:25
  • 1
    @ketan Oh, glad to know that. And Martin seems on the right track. – Barry Wang Apr 19 '19 at 01:10
  • @BarryWang-MSFT sorry i am posting the question link do you have any idea about this in UWP [link](https://stackoverflow.com/q/56034495/11362349) –  May 16 '19 at 06:10

0 Answers0