我找到了这段代码:
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource; if (hwndSource != null) { installedHandle = hwndSource.Handle; viewerHandle = SetClipboardViewer(installedHandle); hwndSource.AddHook(new HwndSourceHook(this.hwndSourceHook)); } }
启动 hwndSourceHook(捕获剪贴板)。但是此代码仅适用于“Window”,但不适用于“Windows.Form”。
我怎样才能让我的表单的 hwndSource 添加 hwndSourceHook?
(而不是覆盖我应该使用我认为的 Form_Load 函数......)
编辑:谢谢,但表单没有 AddHook 函数来添加我的 hwndSourceHook