Attach window to window of another process

后端 未结 3 1965
北海茫月
北海茫月 2020-12-09 14:18

My WPF application has more than one window, I want to attach some of these windows to a window of another process. My problem is that once I attach my window it becomes inv

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 14:50

    private void TryToAttach(IntPtr ownerHandle)
    {
        if(ownerHandle == IntPtr.Zero)
        {
            return;
        }
        try
        {
            var helper = new WindowInteropHelper(window) { Owner = ownerHandle };
        }
        catch(Exception e)
        {
            Logger.Error(e, "Could not attach window.");
        }
    }
    

提交回复
热议问题