Let's say I added some button named `Hide Me` in my dialog and I set the ID to IDC_BUTTON_HIDE_ME. Now, all I need to hide it is to double click on that button and write:
void CMyApplicationDlg::OnBnClickedButtonHideMe()
{
this->GetDlgItem(IDC_BUTTON_HIDE_ME)->ShowWindow(SW_HIDE);
}
void CMyApplicationDlg::OnBnClickedAnotherHideMe()
{
this->AnotherHideMeButton->ShowWindow(SW_HIDE);
}
Quote:
In the main dialog I want to show or hide some buttons, according to some option settings in my program.
Just a simple note, If these options are optional like the proxy settings in this DropBox dialog:
<img src="https://community.mcafee.com/servlet/JiveServlet/showImage/2-200568-16528/dropbox1.JPG"/>[
^]
It's a good idea to use enable and disable instead of hide and show:
void CMyApplicationDlg::OnBnClickedButtonHideMe()
{
this->GetDlgItem(IDC_BUTTON_HIDE_ME)->EnableWindow(FALSE);
}
void CMyApplicationDlg::OnBnClickedAnotherHideMe()
{
this->AnotherHideMeButton->EnableWindow(FALSE);
}