Click here to Skip to main content
15,903,385 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: When is an MFC application fully realized or how to reclaim focus/activation ? Pin
Maximilien8-Oct-10 8:08
Maximilien8-Oct-10 8:08 
GeneralRe: When is an MFC application fully realized or how to reclaim focus/activation ? Pin
Moak8-Oct-10 9:04
Moak8-Oct-10 9:04 
AnswerRe: When is an MFC application fully realized or how to reclaim focus/activation ? Pin
Sauro Viti8-Oct-10 5:04
professionalSauro Viti8-Oct-10 5:04 
AnswerRe: When is an MFC application fully realized or how to reclaim focus/activation ? Pin
Joe Woodbury10-Oct-10 9:08
professionalJoe Woodbury10-Oct-10 9:08 
QuestionScrollbar move with mouse ? Pin
mesajflaviu8-Oct-10 2:51
mesajflaviu8-Oct-10 2:51 
AnswerRe: Scrollbar move with mouse ? Pin
Sauro Viti8-Oct-10 3:51
professionalSauro Viti8-Oct-10 3:51 
GeneralRe: Scrollbar move with mouse ? Pin
mesajflaviu8-Oct-10 5:49
mesajflaviu8-Oct-10 5:49 
GeneralRe: Scrollbar move with mouse ? Pin
Sauro Viti8-Oct-10 10:25
professionalSauro Viti8-Oct-10 10:25 
GeneralRe: Scrollbar move with mouse ? Pin
mesajflaviu9-Oct-10 2:27
mesajflaviu9-Oct-10 2:27 
AnswerRe: Scrollbar move with mouse ? Pin
mesajflaviu11-Oct-10 0:30
mesajflaviu11-Oct-10 0:30 
QuestionCodeJocks ToolkitPro in VS 2010? Pin
Stefan_Lang7-Oct-10 5:42
Stefan_Lang7-Oct-10 5:42 
AnswerRe: CodeJocks ToolkitPro in VS 2010? Pin
Rhuros7-Oct-10 23:29
professionalRhuros7-Oct-10 23:29 
GeneralRe: CodeJocks ToolkitPro in VS 2010? Pin
Stefan_Lang8-Oct-10 2:58
Stefan_Lang8-Oct-10 2:58 
GeneralRe: CodeJocks ToolkitPro in VS 2010? Pin
Rhuros8-Oct-10 3:27
professionalRhuros8-Oct-10 3:27 
GeneralRe: CodeJocks ToolkitPro in VS 2010? Pin
Stefan_Lang8-Oct-10 3:41
Stefan_Lang8-Oct-10 3:41 
AnswerRe: CodeJocks ToolkitPro in VS 2010? Pin
Rhuros8-Oct-10 4:47
professionalRhuros8-Oct-10 4:47 

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.