using NTwain.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Windows.Forms;
namespace NTwain
{
///
/// A customized TWAIN session for use in WPF environment.
/// Use this by using method as the target of delegate.
///
public class TwainSessionWPF : TwainSession
{
///
/// Initializes a new instance of the class.
///
/// The app id.
///
public TwainSessionWPF(TWIdentity appId) : base(appId) { }
///
/// Message loop processor for WPF.
///
/// The window handle.
/// The message ID.
/// The message's wParam value.
/// The message's lParam value.
/// A value that indicates whether the message was handled. Set the value to true if the message was handled; otherwise, false.
///
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand)]
public IntPtr PreFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
var winmsg = new MESSAGE(hwnd, msg, wParam, lParam);
handled = base.HandleWndProcMessage(ref winmsg);
return IntPtr.Zero;
}
}
}