mirror of
https://github.com/soukoku/ntwain.git
synced 2026-01-26 13:39:47 +08:00
Attempt to resurrect my old triplet ideas with new data types and native methods.
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TargetFrameworks>net462;net7.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RootNamespace>SampleConsole</RootNamespace>
|
||||
<LangVersion>11</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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