您可以將一個進程的 Direct3D 窗口渲染到另一個進程的 HWND 中嗎? (Can you render a Direct3D window for one process into another process' HWND?)


問題描述

您可以將一個進程的 Direct3D 窗口渲染到另一個進程的 HWND 中嗎? (Can you render a Direct3D window for one process into another process' HWND?)

我想做的是讓一個 Windows 應用程序啟動另一個 Direct3D 應用程序,並讓 Direct3D 應用程序呈現到父進程提供的控件中。

這可能嗎?如果是,怎麼做?


參考解法

方法 1:

It can be done easly, all you need to do is pass the HWND window id as a parameter when creating D3DDevice. It even works during interop ‑ you can pass the hWnd from .NET to C++ and render C# window using native directX.

方法 2:

Here's one example, hosting content of a WPF window in an existing Win32 window. I did this when writing a WPF‑based screen saver, having to render into the Screen Saver little preview window.

http://stuff.seans.com/2008/09/01/writing‑a‑screen‑saver‑in‑wpf/

方法 3:

This is possible. I remember doing it in VB6 when writing screen savers. The screen saver control panel sends a commandline to the screen saver with the HWND of the preview window. Using that HWND, you can then get the HDC and from there everything else you need.

(by Oliver JonesDror HelperSean SextonRichard C)

參考文件

  1. Can you render a Direct3D window for one process into another process' HWND? (CC BY‑SA 2.5/3.0/4.0)

#direct3d #winapi






相關問題

OpenGL ES 或 Direct3D 中的表面究竟是什麼? (What exactly is a surface in OpenGL ES or Direct3D?)

您可以將一個進程的 Direct3D 窗口渲染到另一個進程的 HWND 中嗎? (Can you render a Direct3D window for one process into another process' HWND?)

OpenGL等圖形庫的目的是什麼? (What is the purpose of a graphics library such as OpenGL?)

Win32 的 CoreImage (CoreImage for Win32)

在 3D 圖形庫中對 I-Section 進行建模 (Modelling an I-Section in a 3D Graphics Library)

編譯器不允許我使用“DDSTextureLoader.h”和“WICTextureLoader.h” (Compiler won't let me use "DDSTextureLoader.h" and "WICTextureLoader.h")

在新紋理上切割具有圓形形狀的 Direct3D 紋理或更改部分像素的 Alpha 值 (cut Direct3D texture with circular shape on a new texture OR change Alpha value of a part of pixels)

Win10上DirectX的SDK在哪裡? (Where is the SDK for DirectX on Win10?)

GLSL / HLSL 著色器中的星球大戰全息效果 (Star Wars holographic effect in GLSL / HLSL shader)

使用 Direct3D 繪製帶有圓角末端的線條 (Drawing lines with rounded endings with Direct3D)

類文件中出現未解析的外部符號 (Unresolved External Symbol Occuring with Class Files)

錯誤,不運行程序(Windows) (error, not run program (windows))







留言討論