I created a dialog ( derives from CSimpleDialog ) with two controls in it
1. Picture control 2. Button control. I placed the Button control on top of
the Picture control. Picture control shows Bitmap in it. In the resource
editor, the button control is visible on top of the Picture control. But
at the run time, Button hides behind the bitmap. It becomes visible when
i click on that area. I tried to change the z order of the button.
I tried the following code.. Nothing works. Does any one knows how to
place controls on top of a Picture control ?
LRESULT CAboutDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
// Bring OK button to the front.
HWND m_hwndOKButton = ::GetDlgItem(m_hWnd, ID_OK);
if (m_hwndOKButton != NULL)
::SetWindowPos(m_hwndOKButton, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED);
HWND hwndPictureBox = ::GetDlgItem(m_hWnd, IDC_BITMAP);
if (hwndPictureBox != NULL)
::SetWindowPos(hwndPictureBox, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW | SWP_FRAMECHANGED);
return 1; // Let the system set the focus
I tried it with ::BringWindowToTop(buttonhandle) method. It didnt work. Is there
any way to bring the Button to the front ?