CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    62

    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.

  2. #2
    Join Date
    Feb 2007
    Posts
    62

    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?

  3. #3
    Join Date
    Aug 2008
    Posts
    902

    Re: Displaying something in another processes window

    Quote Originally Posted by sakurazuka View Post
    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.

  4. #4
    Join Date
    Mar 2011
    Posts
    46

    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
  •  





Click Here to Expand Forum to Full Width

Featured