mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
Removed MSG dependency on WindowsBase
This commit is contained in:
parent
3dc90eff89
commit
5385cc6921
@ -9,7 +9,6 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace NTwain
|
||||
{
|
||||
@ -533,7 +532,7 @@ namespace NTwain
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <returns>True if handled by TWAIN.</returns>
|
||||
protected bool HandleWndProcMessage(ref MSG message)
|
||||
protected bool HandleWndProcMessage(ref MESSAGE message)
|
||||
{
|
||||
if (State >= 4) // technically we should only handle on state >= 5 but there might be missed msgs if we wait until state changes after enabling ds
|
||||
{
|
||||
@ -604,5 +603,22 @@ namespace NTwain
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The MSG structure in Windows for TWAIN use.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
protected struct MESSAGE
|
||||
{
|
||||
public IntPtr hwnd;
|
||||
public uint message;
|
||||
public IntPtr wParam;
|
||||
public IntPtr lParam;
|
||||
public uint time;
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ using NTwain.Data;
|
||||
using NTwain.Values;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Permissions;
|
||||
using System.IO;
|
||||
@ -246,10 +245,10 @@ namespace NTwain
|
||||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
|
||||
bool IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message m)
|
||||
{
|
||||
MSG winmsg = default(MSG);
|
||||
MESSAGE winmsg = default(MESSAGE);
|
||||
winmsg.hwnd = m.HWnd;
|
||||
winmsg.lParam = m.LParam;
|
||||
winmsg.message = m.Msg;
|
||||
winmsg.message = (uint)m.Msg;
|
||||
winmsg.wParam = m.WParam;
|
||||
|
||||
return HandleWndProcMessage(ref winmsg);
|
||||
@ -267,10 +266,10 @@ namespace NTwain
|
||||
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand)]
|
||||
public IntPtr PreFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
MSG winmsg = default(MSG);
|
||||
MESSAGE winmsg = default(MESSAGE);
|
||||
winmsg.hwnd = hwnd;
|
||||
winmsg.lParam = lParam;
|
||||
winmsg.message = msg;
|
||||
winmsg.message = (uint)msg;
|
||||
winmsg.wParam = wParam;
|
||||
|
||||
handled = base.HandleWndProcMessage(ref winmsg);
|
||||
|
@ -5,7 +5,6 @@ using System.Linq;
|
||||
using System.Security.Permissions;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace NTwain
|
||||
{
|
||||
@ -34,10 +33,10 @@ namespace NTwain
|
||||
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand)]
|
||||
public IntPtr PreFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
MSG winmsg = default(MSG);
|
||||
MESSAGE winmsg = default(MESSAGE);
|
||||
winmsg.hwnd = hwnd;
|
||||
winmsg.lParam = lParam;
|
||||
winmsg.message = msg;
|
||||
winmsg.message = (uint)msg;
|
||||
winmsg.wParam = wParam;
|
||||
|
||||
handled = base.HandleWndProcMessage(ref winmsg);
|
||||
|
@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace NTwain
|
||||
{
|
||||
@ -25,10 +24,10 @@ namespace NTwain
|
||||
|
||||
bool IMessageFilter.PreFilterMessage(ref Message m)
|
||||
{
|
||||
MSG winmsg = default(MSG);
|
||||
MESSAGE winmsg = default(MESSAGE);
|
||||
winmsg.hwnd = m.HWnd;
|
||||
winmsg.lParam = m.LParam;
|
||||
winmsg.message = m.Msg;
|
||||
winmsg.message = (uint)m.Msg;
|
||||
winmsg.wParam = m.WParam;
|
||||
|
||||
return HandleWndProcMessage(ref winmsg);
|
||||
|
Loading…
Reference in New Issue
Block a user