How can you bring a control to front/top in mfc?

  • Thread starter Thread starter sgrm123
  • Start date Start date
S

sgrm123

Guest
Hi,

I have a MFC dialog based application.

I am displaying a dynamically created listbox when clicking on the button. This listbox is overlapping with the already existing list control in the dialog.

I am calling to display the listbox.

listbox.ShowWindow(SW_SHOW);
listbox.BringWindowToTop();

and whenever I update the contents of listcontrol the listbox is going behind the listbox so I set the WS_CLIPSIBLINGS style to the list control as suggested by the link Unable to select items in ListBox?

Is it possible without using WS_CLIPSIBLINGS style, by changing z order of the listbox using setwindowspos can I achieve my requirement?

I tried below code but it didn't work but if I set WS_CLIPSIBLINGS syle to list control then only below code is working.

GetDlgItem(IDC_LIST1)->SetWindowPos(&wndTop, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE);

How o display the control always in the top eventhough other controls get painted/updated?

I have shared my application in this path.

https://aspiresysinc-my.sharepoint....BOtszk5kRaPT0BqRacTqhdLMAE-vTgdIYfbw?e=L7nnAe

Thanks

Continue reading...
 
Back
Top