是否可以将 Win32 应用程序的输出重定向到图片框?
我以前见过将 Windows Media Player 的输出重定向到 C# 中的 Picturebox 的代码示例。我有兴趣为其他 Win32 应用程序执行此操作。考虑到我可以获得要重定向其输出的进程的 hWnd 句柄,我该如何实现我的目标?
我可以使用 user32.dll 的 ShowWindow 方法最小化/最大化进程窗口,所以我猜测应该有一个解决方案来解决我的问题。
谢谢。
I've previously seen code samples that redirect Windows Media Player's output to a Picturebox in C#. I am interested in doing this for other Win32 applications. Considering the fact that I can get hWnd handle of the process that I want to redirect its output, how can I accomplish my goal?
I can minimize/maximize the process' window using user32.dll's ShowWindow method, so I am guessing there should be a solution for my problem.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议阅读有关桌面 Windows 管理器(Windows Vista 中引入的功能)的信息:
http://msdn.microsoft.com/en -us/library/aa969540(v=VS.85).aspx
我相信它具有您寻求的功能。
我首先阅读有关
DwmRegisterThumbnail
函数,它附加两个HWND
,以便一个窗口也绘制在第二个窗口上。使用此方法,您可以在从PictureBox.Handle
属性获取的HWND
上绘制 Windows Media Player。StackOverflow 中还有很多关于此主题的问题和解答。使用搜索词“dwm”会产生相当多的结果:https://stackoverflow.com/search?q=dwm
I'd suggest reading about Desktop Windows Manager (feature introduced in Windows Vista):
http://msdn.microsoft.com/en-us/library/aa969540(v=VS.85).aspx
I believe it has the capabilities you seek.
I would start by reading about the
DwmRegisterThumbnail
function, which attaches twoHWND
s so that one window is also painted on the second one. Using this method you may be able to cause Windows Media Player to be drawn on theHWND
obtained from yourPictureBox.Handle
property.There are also a lot of questions and answers about this topic here in StackOverflow. Using the search word "dwm" yields quite a few results: https://stackoverflow.com/search?q=dwm