-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinUI3 Sample #41
Comments
It essentially needs to be able to get into the UI message loop to intercept messages and pass some of them to TWAIN. This does not seem possible when I investigated before. There's no extensibility point at that level like winform/wpf does. If that's still true, one choice is to run your own message pump in another thread. Unfortunately I'm probably not experienced enough in win32 to make one correctly (maybe I can try in the future). Another option is to run a separate process based on winform/wpf that the main app talks to through some IPC mechanism. That's what I was trying to do with the signalr test :p |
I managed to hook into the message loop in a WinUi3 application with this code: But instead of WinMsg I used your WIN_MESSAGE. But I don't know how to implement it in NTwain. Maybe you will have more luck if you want to try it. You are probably more experienced than me. 😅 |
While I appear to have a working self-hosted loop using winform that works in other places (like avalon ui), WinUI3 apps just don't seem to work with twain in general. Showing the old select dialog and opening a source doesn't require hooking into the mesage loop and even those don't work right. I suspect the dynamic loading nature of sources are restricted or something though I have no proof. Your only option may be a separate exe process that you control through some IPC. |
Ah ok i see.. If i succeed, i will create a PR with a WinUi3 sample 👍 |
So I thought I would chime in here, basically you have two options. If you select your winui3 app to run unpackaged it will natively have access to win32 apis. This should allow ntwain to work. But a key new feature in Winui3 vs UWP is allowing fulltrust applications within the app package. So if you open package manifest and set uap10:TrustLevel attribute in and I believe add the following capabilities are necessary, but it has been months since I initially set up so a little foggy:
I am successfully using Ntwain in this capacity in a WinUi3 application. This is actually a great improvement because before we were using a UWP app and had to have an IPC to a win32 app that did the scanning and pass back scan. |
Thx, if i run it unpackaged it works. |
I have managed to get it work with WinUi3. |
Hi @soukoku,
could you try to provide a WinUi3 sample?
I would code it by myself but i currently have no working scanner available.
I have tried it in the past with v3 but it was not working.
Maybe it is possible in v4?
The text was updated successfully, but these errors were encountered: