Many thanks to Alain Rist. the problem is solved!!! ;)
Specially for Pallini
I guess how you became a gold member... just posting something... if you r so clever, please, don't tell me to hide the button, but explain me WHY the button in the background is clicked instead of the button in foreground!
My question may seem to be very stupid, but...
RECT rc;
...
rc.right = 50;
rc.bottom = 50;
mpButton1 = new CButton;
mpButton1->Create( strCaption1, WS_VISIBLE | WS_CHILD | WS_TABSTOP, rc, this, 1003 );
rc.right = 100;
rc.bottom = 100;
mpButton2 = new CButton;
mpButton2->Create( strCaption2, WS_VISIBLE | WS_CHILD | WS_TABSTOP, rc, this, 1004 );
::SetWindowPos( mpButton1->GetSafeHwnd(), HWND_TOP,0, 0, 100, 100, SWP_NOMOVE | SWP_NOSIZE );
...
I expect that clicking on RECT(0,0,50,50) will not press mpButton1. But it is pressed.
Can somebody explain me why the click on RECT(0,0,50,50) presses mpButton1?
And how can I bring mpButton2 to front, so the mpButton1 will not be active while the other button is over it.
And, please, don't tell me other ways of solving the problem such as (make it disable, or make it invisible... etc)
Thank you in advance
P.S. (after John Simmons's answer)
1. There is no dialog box.
2. Buttons are dynamically created in CWnd
3. There is no problem with visibility. I DO WANT that buttons both are visible.
To Alain Rist. The problem not in RECT. I didn't include the code for assigning a values to rc.left and rc.top, but be sure, variable rc gets proper values in the application :) Second button is bigger button, that COVERS the first one, but if click is on the area of SMALL button the small button is clicked. I tried to place the first button to HWND_BOTTOM, and the second one to HWND_TOP.... nothing helps! :)