I use CreateWindow to create a window, say window 'A', and window 'A' creates window 'B'. when 'B' is closed, focus is given to 'A', which is reasonable. buf if before closing 'B' I click on the window of another application and then close 'B', then the systems transfers focus to that application, not 'A'. I want to change this behaviour and try setfocus to window 'A' directly, buf I was not successfull. I tried these codes
SetFocus( hWndA );
SendMessage( hWndA, WM_SETFOCUS, 0, 0 );
PostMessage( hWndA, WM_SETFOCUS, 0, 0 );
SendMessage( hWndA, WM_APP, 0, 0 );
PostMessage( hWndA, WM_APP, 0, 0 );
where window 'A' responds to WM_APP by setting focus to itself, and none of them workded. SetFocus simply failes, Can any body help me?