19 using System.Collections.Generic;
23 using Forms =
System.Windows.Forms;
24 using System.Windows.Interop;
34 #region Public static delegate 49 #region Public property 63 Logger.Debug(
"No handle has been set, and no handle provider exists");
68 Logger.Debug(
"Obtaining handle from MainWindowHandleProvider");
72 Logger.Info(
"Using main window handle 0x{0:X08}", h.ToInt64());
87 Logger.Debug(
"Creating new Win32Window instance that uses the MainWindowHandleProvider");
95 _handle = form.Handle;
96 Logger.Debug(
"Creating new Win32Window instance with the form handle 0x{0:X08}", _handle.ToInt64());
105 _handle = (
new WindowInteropHelper(window)).
Handle;
106 Logger.Debug(
"Creating new Win32Window instance with the WPF window handle 0x{0:X08}", _handle.ToInt64());
115 Logger.Debug(
"Creating new Win32Window instance with the WPF window handle 0x{0:X08}", _handle.ToInt64());
120 #region Private fields 122 private IntPtr _handle;
128 private static NLog.Logger Logger {
get {
return _logger.Value; } }
130 private static readonly Lazy<
NLog.Logger> _logger =
new Lazy<
NLog.Logger>(() =>
NLog.LogManager.GetCurrentClassLogger());
Win32Window(IntPtr handle)
Creates a new instance that wraps a handle .
static Func< IntPtr > MainWindowHandleProvider
Gets or sets a function that provides the global window handle of the main window of an application...
Provides access to the window handle of a WPF window or a Form or a custom handle.
Win32Window(Forms.Form form)
Creates a new instance whose handle is obtained from a Form.
Win32Window()
Creates a new instance whose handle must be provided by the MainWindowHandleProvider ...
IntPtr Handle
Gets the handle that is wrapped by this class.
Win32Window(Window window)
Creates a new instance whose handle is obtained from a WPF window.