Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help me to implement it. Pin
Le@rner10-Oct-10 18:14
Le@rner10-Oct-10 18:14 
GeneralRe: Help me to implement it. Pin
David Crow11-Oct-10 1:55
David Crow11-Oct-10 1:55 
GeneralRe: Help me to implement it. Pin
Le@rner11-Oct-10 2:28
Le@rner11-Oct-10 2:28 
GeneralRe: Help me to implement it. Pin
Le@rner14-Oct-10 18:18
Le@rner14-Oct-10 18:18 
GeneralRe: Help me to implement it. Pin
David Crow15-Oct-10 2:40
David Crow15-Oct-10 2:40 
GeneralMessage Removed Pin
15-Oct-10 2:51
Le@rner15-Oct-10 2:51 
GeneralRe: Help me to implement it. Pin
David Crow15-Oct-10 2:56
David Crow15-Oct-10 2:56 
GeneralRe: Help me to implement it. Pin
Le@rner15-Oct-10 3:00
Le@rner15-Oct-10 3:00 
GeneralRe: Help me to implement it. Pin
David Crow15-Oct-10 4:02
David Crow15-Oct-10 4:02 
GeneralRe: Help me to implement it. Pin
Le@rner15-Oct-10 18:16
Le@rner15-Oct-10 18:16 
AnswerRe: Help me to implement it. Pin
David Crow18-Oct-10 9:55
David Crow18-Oct-10 9:55 
GeneralRe: Help me to implement it. Pin
Le@rner17-Oct-10 21:03
Le@rner17-Oct-10 21:03 
AnswerRe: Help me to implement it. Pin
Code-o-mat10-Oct-10 21:09
Code-o-mat10-Oct-10 21:09 
QuestionOpenGL integration with SDL, problem Pin
James_7228-Oct-10 22:38
James_7228-Oct-10 22:38 
AnswerRe: OpenGL integration with SDL, problem Pin
LunaticFringe9-Oct-10 1:07
LunaticFringe9-Oct-10 1:07 
GeneralRe: OpenGL integration with SDL, problem Pin
James_7229-Oct-10 3:42
James_7229-Oct-10 3:42 
AnswerRe: OpenGL integration with SDL, problem Pin
Cedric Moonen10-Oct-10 0:53
Cedric Moonen10-Oct-10 0:53 
Questionproblem in Access database use with CRecordset class. Pin
Le@rner8-Oct-10 19:58
Le@rner8-Oct-10 19:58 
AnswerRe: problem in Access database use with CRecordset class. Pin
Niklas L8-Oct-10 21:32
Niklas L8-Oct-10 21:32 
GeneralRe: problem in Access database use with CRecordset class. Pin
Le@rner8-Oct-10 21:43
Le@rner8-Oct-10 21:43 
AnswerRe: problem in Access database use with CRecordset class. Pin
David Crow9-Oct-10 15:58
David Crow9-Oct-10 15:58 
QuestionErrors not being reported on Windows Server 2003 box Pin
Interrobang8-Oct-10 10:06
Interrobang8-Oct-10 10:06 
AnswerRe: Errors not being reported on Windows Server 2003 box Pin
Rolf Kristensen8-Oct-10 12:01
Rolf Kristensen8-Oct-10 12:01 
QuestionWhen is an MFC application fully realized or how to reclaim focus/activation ? Pin
Maximilien8-Oct-10 4:26
Maximilien8-Oct-10 4:26 
When is an MFC application fully realized?
---

I've got an MFC application A that creates a new MFC dialog application B with CreateProcess.

When application B is created, A looses focus and I need to have A reclaim the focus.

I've tried a few different things but none seem to be working.

I create the process like this:
if( CreateProcess( NULL, cCommandLine.GetBuffer(), NULL, NULL, FALSE,  NORMAL_PRIORITY_CLASS, NULL, NULL, &si, pi ) )
{
  WaitForInputIdle (pi->hProcess, INFINITE);
  return (pi->hProcess);
}


After that, I tried individually or mix'n'match between them:

mainframe->SetFocus();
mainframe->ActivateFrame();
mainframe->PostMessage( WM_ACTIVATEAPP, TRUE, 0 );
mainframe->PostMessage( WM_ACTIVATE, TRUE, 0 );


I even tried sending (HWND_BROADCAST) a message from B to A at the end of B's OnInitDialog, but maybe it's too early in B life-time to broadcast that message.

- Am I missing something ?
- Can A reclaim itself the focus ? or re-activate itself without user intervention ?
- When is B fully realized and ready so I can broadcast a message back to A ?

Thanks.

Max.
Watched code never compiles.

AnswerRe: When is an MFC application fully realized or how to reclaim focus/activation ? Pin
Moak8-Oct-10 5:03
Moak8-Oct-10 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.