protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); User32.SetParent(Handle, (IntPtr)User32.HwndMessage); User32.AddClipboardFormatListener(Handle); }
// on load: (hide this window) protected override void SetVisibleCore(bool value) { CreateHandle(); mInstance = this; bool b = User32.AddClipboardFormatListener(mInstance.Handle); base.SetVisibleCore(false); }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); Handle = new WindowInteropHelper(this).Handle; HwndSource source = PresentationSource.FromVisual(this) as HwndSource; source?.AddHook(new HwndSourceHook(WndProcHook)); // Clipboard User32.AddClipboardFormatListener(Handle); }
public bool RegisterClipboardListener() { if (Environment.OSVersion.Version.Major < 6) { m_bCallingSetClipboardViewer = true; hwndNextViewer = User32.SetClipboardViewer(this.Handle); m_bCallingSetClipboardViewer = false; if (hwndNextViewer != IntPtr.Zero) { return(true); } else { return(false); } } else { return(User32.AddClipboardFormatListener(this.Handle)); } }
void RegisterWin32() { User32.AddClipboardFormatListener(Handle); }