Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu29-Dec-16 21:58
_Flaviu29-Dec-16 21:58 
GeneralRe: WM_SHOWWINDOW not called Pin
leon de boer29-Dec-16 22:33
leon de boer29-Dec-16 22:33 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu29-Dec-16 23:36
_Flaviu29-Dec-16 23:36 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu29-Dec-16 23:37
_Flaviu29-Dec-16 23:37 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu30-Dec-16 1:07
_Flaviu30-Dec-16 1:07 
GeneralRe: WM_SHOWWINDOW not called Pin
leon de boer30-Dec-16 3:15
leon de boer30-Dec-16 3:15 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu30-Dec-16 3:18
_Flaviu30-Dec-16 3:18 
GeneralRe: WM_SHOWWINDOW not called Pin
leon de boer30-Dec-16 3:38
leon de boer30-Dec-16 3:38 
That should only work for the focused child window. Unless MFC overrides windows and activates each window in Z order.

Windows normally when it brings up a group of children will only activate them along the focus chain in non MFC. Its very specific on the API.
WM_ACTIVATE message (Windows)[^]
Sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated.

By default each window will call down to it's parent to make sure it is activated in a direct line along the focus chain. You can basically follow the activation chain upwards from the application window and arrive at the focus window which is how keyboard messages etc find there way to the right window. So at no stage should two MDI children be active and the active one generally paints it's frame a different colour and brings itself to top (that is the default behviour). The only other child window that would get a normal windows API message is the one losing the focus chain. However if you had 3 children there would always be one window that would never get an activation message no matter what you did as it will neither be gaining or losing activation/focus chain.

I would not expect that behaviour on MFC unless it does it's own thing and does a lot of repainting that is totally not done on actual windows API. Given the weird nature of that call with nCmdShow that is possible, all be it a bit naft and horrible hack.

The WM_WINDOWPOSCHANGED I gave you does go to each and every child which is also why they tell you that you probably want to override it
WM_WINDOWPOSCHANGED message (Windows)[^]
By default, the DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window. The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.
In vino veritas


modified 30-Dec-16 10:01am.

GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu31-Dec-16 11:49
_Flaviu31-Dec-16 11:49 
GeneralRe: WM_SHOWWINDOW not called Pin
leon de boer5-Jan-17 22:05
leon de boer5-Jan-17 22:05 
GeneralRe: WM_SHOWWINDOW not called Pin
_Flaviu8-Jan-17 20:39
_Flaviu8-Jan-17 20:39 
Questionc++, how to make an array program one dimension from( 1 to 7 numbers)that the user insert these numbers in terminal that finally display sum,average,GPA,grade,min and max. please help me Pin
Alma2829-Dec-16 4:08
Alma2829-Dec-16 4:08 
AnswerRe: c++, how to make an array program one dimension from( 1 to 7 numbers)that the user insert these numbers in terminal that finally display sum,average,GPA,grade,min and max. please help me Pin
Midi_Mick29-Dec-16 4:20
professionalMidi_Mick29-Dec-16 4:20 
AnswerRe: c++, how to make an array program one dimension from( 1 to 7 numbers)that the user insert these numbers in terminal that finally display sum,average,GPA,grade,min and max. please help me Pin
Patrice T30-Dec-16 11:57
mvePatrice T30-Dec-16 11:57 
QuestionEmbedding Python in C++ Pin
VISWESWARAN199824-Dec-16 1:14
professionalVISWESWARAN199824-Dec-16 1:14 
AnswerRe: Embedding Python in C++ Pin
Afzaal Ahmad Zeeshan24-Dec-16 2:54
professionalAfzaal Ahmad Zeeshan24-Dec-16 2:54 
PraiseRe: Embedding Python in C++ Pin
VISWESWARAN199824-Dec-16 3:15
professionalVISWESWARAN199824-Dec-16 3:15 
GeneralClass and Object memory layout question Pin
samzcs21-Dec-16 4:24
samzcs21-Dec-16 4:24 
GeneralRe: Class and Object memory layout question Pin
Richard MacCutchan21-Dec-16 4:44
mveRichard MacCutchan21-Dec-16 4:44 
GeneralRe: Class and Object memory layout question Pin
samzcs21-Dec-16 5:37
samzcs21-Dec-16 5:37 
GeneralRe: Class and Object memory layout question Pin
Richard MacCutchan21-Dec-16 5:58
mveRichard MacCutchan21-Dec-16 5:58 
GeneralRe: Class and Object memory layout question Pin
samzcs21-Dec-16 6:23
samzcs21-Dec-16 6:23 
GeneralRe: Class and Object memory layout question Pin
Richard MacCutchan21-Dec-16 6:46
mveRichard MacCutchan21-Dec-16 6:46 
GeneralRe: Class and Object memory layout question Pin
samzcs21-Dec-16 7:26
samzcs21-Dec-16 7:26 
GeneralRe: Class and Object memory layout question Pin
leon de boer21-Dec-16 14:50
leon de boer21-Dec-16 14:50 

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.