The titles says the most of it really.
I have two applications, the first is a full directX application written in c++, the second application is written in c# and renders flash videos, avi's, pdf's etc using ActiveX COM objects. The first application then captures the content of this c# app, and renders it into the 3d environment as a texture. This all works as intended, and I have code in the directX app to allow me to send key and mouse events to the c# app via SendMessage and PostMessage.
My problem lies with initial startup. I have the c# app set to start up without activation, using:
protected override bool ShowWithoutActivation { get { return true; } }
which is the equivalent of SW_SHOWNOACTIVATE in the CreateProcess call. The application launches fine, and renders fine on the c++ app's texture. However, the very first mouse click forces the c# application to steal focus, and thus drops my directx context. Does anybody know why this happens, or if there's any way around it?
If I launch the c# app and dont ever click on it, the c++ app when launched still runs as intended, its only when launching it through code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESIZE;
si.wShowWindow = SW_SHOWNORMAL;
si.dwXSize = 400;
si.dwYSize = 400;
if(!::CreateProcess(program, arguments, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
return false;
}
else
{
// use EnumWindows to conforim the app is open and get its HANDLE
}
Cheers in advance for any help, Wayne