Attach window to window of another process
My WPF application has more than one window, I want to attach some of these windows 二进制机器人WS评论 to a window of another process. My problem is that once I attach my window it becomes invisible.
I'm trying this with the following code:
So, the above code successfully attaches the 二进制机器人WS评论 window, but unfortunately makes it invisible.二进制机器人WS评论
My reason for doing this is that I'm trying to extend an 二进制机器人WS评论 二进制机器人WS评论 application by building "Widgets" for it, my widgets will hook in and show the user extra information.
Both windows have the following styles: WS_OVERLAPPEDWINDOW, WS_OVERLAPPED, WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN.
@Neil: I've added the styles to the end of my question, by attach I mean that I want my WPF window to be a child of the new window.
@DavidHeffernan: My window needs to either be a child, or just appear (to the user) to be a child. Do you 二进制机器人WS评论 know anyway to do the latter.
Do you have control of the other app? If so, then do the coding in that other app. If not then what makes you think that you can push another processes window, and a WPF one at that, into this other app?
3 Answers 3
Trending sort 二进制机器人WS评论 is based off of the default sorting method — by highest score — 二进制机器人WS评论 but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
I found that 二进制机器人WS评论 二进制机器人WS评论 I could do this without even using the setParent call. I used HwndSource class as follows:
This is working great now without any problems.
Hi @Gerve. Yours 二进制机器人WS评论 is the only example I could find of what I'm trying to 二进制机器人WS评论 do, but it doesn't work for me. Spy++ tells me that in my case, MyWindow is NOT a child of newParent. My questions are: a) 二进制机器人WS评论 what values do you set for the WindowStyle, AllowsTransparency and Background properties of MyWindow in MyWindow.xaml? b) Do you call Show() on the window? If so does it matter whether you do it before or after the above code? c) In my case, MyWindow gets the WS_EX_LAYERED extended style, which I read is incompatible with child windows. Not sure why. d) Do you set any other styles with SetWindowLong()?
My WPF Window has always a black background (regardless if I set it's background color to transparent (and allow transparency) or 二进制机器人WS评论 to a color).
I'm not sure 二进制机器人WS评论 what you need to do with overlapped windows, but from MSDN:
For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should 二进制机器人WS评论 also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent.
While this may answer the question, it doesn't provide any context to explain how or why. Consider adding a sentence or two to explain your answer.
WindowInteropHelper is class from System.Windows.Interop namesapce. Assists interoperation between Windows Presentation Foundation (WPF) and Win32 code.
I'm glad to see you're trying to improve your answer, as a rule you should add clarifications like that in your answer by editing rather than in the comments. Comments 二进制机器人WS评论 can get cleaned up and not everyone reads them so your clarification could be missed.
评论 | 唯色： 二进制机器人WS评论 平措汪杰先生谈昌都战役后的阿沛·阿旺晋美（五）
右二为拉乌达热·土丹旦达。（翻拍戈尔茨坦著作《西藏现代史: 暴风雨之前的平静, 1951-1955 第二卷》）
评论 | 唯色：疫情期间赫然出现在大昭寺前的两座中式碑亭（上）
Establishing Security for Cloud Healthcare Solutions
In this on-demand webinar, experts from Change Healthcare, HITRUST, and Google Cloud Healthcare and Life 二进制机器人WS评论 Sciences discuss data privacy regulations, encryption at rest, third-party certification, and the critical nature of shared responsibility for cloud security.