-
February 1st, 2011, 05:20 PM
#1
Displaying something in another processes window
Hi guys,
I was recently trying to write an app that would display some directx content in another processes window. In order to do that I locate the handle for the window and then try to create a DIRECT3DDEVICE9 for this window and it always returns as a result D3DERR_INVALIDCALL. Is it possilble to make this work?
Here is the part of code that doesn't work - maybe the error lies here?
Code:
LPDIRECT3D9 g_pD3D = NULL;
D3DPRESENT_PARAMETERS d3dpp;
IDirect3DDevice9* d3dDev;
HRESULT result;
ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS));
d3dpp.hDeviceWindow = this->m_pWindow->m_hWnd;
if( NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
MessageBox(NULL, _T("Direct3D fail"), _T("Fail"), MB_OK);
result = g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, this->m_pWindow->m_hWnd, D3DCREATE_NOWINDOWCHANGES, &d3dpp, &d3dDev);
if(result == D3D_OK)
{
this->m_bDevSet = TRUE;
}
Thanks.
-
February 27th, 2011, 06:16 PM
#2
Re: Displaying something in another processes window
Self-bumping before this disapears. Lets abstract for a minute from the DirectX api - is drawing something in another processes window possible in any way?
-
March 19th, 2011, 09:04 PM
#3
Re: Displaying something in another processes window
Originally Posted by sakurazuka
is drawing something in another processes window possible in any way?
I can't be certain, but if I had to guess, I'd say no. If that's the case, you could try using something like CreateRemoteThread to execute your DirectX code from inside the other process.
-
March 21st, 2011, 11:20 AM
#4
Re: Displaying something in another processes window
It's one of those not recommended things it would get messy even if you could do it that way.
If you are the writter of the two apps it sounds like something like interprocess communication (http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx) would solve your problem or do multithreaded as a single app as suggested.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|