mirror of
https://github.com/soukoku/ntwain.git
synced 2026-01-09 11:21:06 +08:00
Fix internal window being visible.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<!--change these in each release-->
|
||||
<VersionPrefix>4.0.0.0</VersionPrefix>
|
||||
<VersionSuffix>alpha.22</VersionSuffix>
|
||||
<VersionSuffix>alpha.23</VersionSuffix>
|
||||
|
||||
<!--keep it the same until major # changes-->
|
||||
<AssemblyVersion>4.0.0.0</AssemblyVersion>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#if WINDOWS || NETFRAMEWORK
|
||||
using NTwain.Data;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -54,7 +55,7 @@ namespace NTwain
|
||||
}
|
||||
else
|
||||
{
|
||||
_dummyForm.Close();
|
||||
_dummyForm.Close(true);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -81,7 +82,7 @@ namespace NTwain
|
||||
if (sts.IsSuccess)
|
||||
{
|
||||
_twain.RemoveWinformFilter();
|
||||
_dummyForm.Close();
|
||||
_dummyForm.Close(true);
|
||||
_twain = null;
|
||||
}
|
||||
tcs.SetResult(sts);
|
||||
@@ -116,25 +117,46 @@ namespace NTwain
|
||||
public DummyForm()
|
||||
{
|
||||
ShowInTaskbar = false;
|
||||
WindowState = FormWindowState.Minimized;
|
||||
Text = "NTwain Internal Loop";
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
cp.ExStyle |= 0x80; // WS_EX_TOOLWINDOW
|
||||
return cp;
|
||||
}
|
||||
base.OnHandleCreated(e);
|
||||
}
|
||||
|
||||
//protected override CreateParams CreateParams
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// CreateParams cp = base.CreateParams;
|
||||
// cp.ExStyle |= 0x80; // WS_EX_TOOLWINDOW
|
||||
// return cp;
|
||||
// }
|
||||
//}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
BringToFront();
|
||||
Hide();
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
bool _closeForReal = false;
|
||||
internal void Close(bool forReal)
|
||||
{
|
||||
_closeForReal = forReal;
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
if (e.CloseReason == CloseReason.UserClosing && !_closeForReal)
|
||||
{
|
||||
e.Cancel = true;
|
||||
Hide();
|
||||
}
|
||||
base.OnFormClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user