I have two applications, the first is a full directX application written in C ++, the second application is written in C # and displays flash movies, avi, pdf, etc. using COM ActiveX objects. The first application then captures the contents of this C # application and displays it in a 3D environment as a texture. It all works as intended, and I have the code in the directX application to allow me to send key and mouse events to the C # application via SendMessage and PostMessage.
My problem is the initial start up. I have a set of C # applications to run without activation using:
protected override bool ShowWithoutActivation
{
get { return true; }
}
which is the equivalent of SW_SHOWNOACTIVATE in a call to CreateProcess. The application runs fine and perfectly displays the texture of the C ++ application. However, the very first mouse click causes the C # application to steal focus and, thus, reduces my directx context. Does anyone know why this is happening, or if there is any way around it?
If I run a C # application and never click on it, the C ++ application at startup still works as intended, only when launched through the 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
{
}
Welcomes in advance for any help, Wayne