mirror of
https://github.com/soukoku/ntwain.git
synced 2026-01-26 21:48:36 +08:00
Attempt to resurrect my old triplet ideas with new data types and native methods.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using NTwain;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using TWAINWorkingGroup;
|
||||
|
||||
namespace SampleConsole
|
||||
{
|
||||
@@ -7,8 +10,20 @@ namespace SampleConsole
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var twain = new TwainSession(Environment.ProcessPath ?? Assembly.GetExecutingAssembly().Location);
|
||||
TwainPlatform.PreferLegacyDSM = true;
|
||||
|
||||
var twain = new TwainSession(Assembly.GetExecutingAssembly().Location);
|
||||
twain.StateChanged += Twain_StateChanged;
|
||||
|
||||
var hwnd = IntPtr.Zero;
|
||||
var rc = twain.DGControl.Parent.OpenDSM(ref hwnd);
|
||||
Debug.WriteLine($"OpenDSM={rc}");
|
||||
|
||||
if (rc == TWAINWorkingGroup.STS.SUCCESS)
|
||||
{
|
||||
Debug.WriteLine($"CloseDSM={rc}");
|
||||
rc = twain.DGControl.Parent.CloseDSM(ref hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Twain_StateChanged(TwainSession session, TWAINWorkingGroup.STATE state)
|
||||
|
||||
Reference in New Issue
Block a user