Hello to all,
During build, I keep getting this error:
<b> C:\Program Files\Microsoft Visual Studio\MyProjects\buttons\buttonsDlg.cpp(246) : error C2660: 'GetDlgItem' : function does not take 1 parameters </b>
I recently added the member function ChangeDialogTitle(UINT nID) which will modify the dialog box's title during run time, depending on which button is pressed. Here is my code. Any help as to why I keep getting this error will be greatly appreciated
<code>
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CButtonsDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CButtonsDlg::OnShowHide()
{
// TODO: Add your control notification handler code here
//check if the left button is currently visible
BOOL bVisible = GetDlgItem(IDC_LEFT) -> IsWindowVisible ();
//** Toggle the visbility of each control
GetDlgItem(IDC_LEFT) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
GetDlgItem(IDC_CENTER) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
GetDlgItem(IDC_RIGHT) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
//**Toggle the show/hide's button caption
GetDlgItem(IDC_SHOW_HIDE) -> SetWindowText(bVisible? "Show" : "Hide"
;
}
void CButtonsDlg::OnEnableDisable()
{
// TODO: Add your control notification handler code here
//** Obtain the current state of the Left button
BOOL bState = GetDlgItem(IDC_LEFT) -> IsWindowEnabled();
//** Toggle the stat of each control
GetDlgItem(IDC_LEFT) -> EnableWindow(!bState);
GetDlgItem(IDC_CENTER) -> EnableWindow(!bState);
GetDlgItem(IDC_RIGHT) -> EnableWindow(!bState);
//** Toggle the Enable/Disable button's caption
GetDlgItem(IDC_ENABLE_DISABLE) -> SetWindowText(bState? "Enable" : "Disable"
;
}
void CButtonsDlg::ChangeDialogTitle(UINT nID)
{
}
void CButtonsDlg::OnLeft()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_LEFT);
}
void CButtonsDlg::OnCenter()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_CENTER);
}
void CButtonsDlg::OnRight()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_RIGHT);
}
void CButtonsDlgChangeDialogTitle(UINT nID)
{
CString strCaption;
//** Get label of the button that was clicked
GetDlgItem(nID) -> GetWindowText(strCaption);
strCaption += " was pressed";
//**Check if the button is the same as the last time
if(m_nIDofLastButton += nID)
strCaption += " again";
//** Set the caption of the dialog box
setWindowText(strCaption);
//** Store the ID of the clicked button
m_nIDofLastButton = nID;
}
</code>
During build, I keep getting this error:
<b> C:\Program Files\Microsoft Visual Studio\MyProjects\buttons\buttonsDlg.cpp(246) : error C2660: 'GetDlgItem' : function does not take 1 parameters </b>
I recently added the member function ChangeDialogTitle(UINT nID) which will modify the dialog box's title during run time, depending on which button is pressed. Here is my code. Any help as to why I keep getting this error will be greatly appreciated
<code>
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CButtonsDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CButtonsDlg::OnShowHide()
{
// TODO: Add your control notification handler code here
//check if the left button is currently visible
BOOL bVisible = GetDlgItem(IDC_LEFT) -> IsWindowVisible ();
//** Toggle the visbility of each control
GetDlgItem(IDC_LEFT) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
GetDlgItem(IDC_CENTER) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
GetDlgItem(IDC_RIGHT) -> ShowWindow(bVisible? SW_HIDE : SW_SHOW);
//**Toggle the show/hide's button caption
GetDlgItem(IDC_SHOW_HIDE) -> SetWindowText(bVisible? "Show" : "Hide"
}
void CButtonsDlg::OnEnableDisable()
{
// TODO: Add your control notification handler code here
//** Obtain the current state of the Left button
BOOL bState = GetDlgItem(IDC_LEFT) -> IsWindowEnabled();
//** Toggle the stat of each control
GetDlgItem(IDC_LEFT) -> EnableWindow(!bState);
GetDlgItem(IDC_CENTER) -> EnableWindow(!bState);
GetDlgItem(IDC_RIGHT) -> EnableWindow(!bState);
//** Toggle the Enable/Disable button's caption
GetDlgItem(IDC_ENABLE_DISABLE) -> SetWindowText(bState? "Enable" : "Disable"
}
void CButtonsDlg::ChangeDialogTitle(UINT nID)
{
}
void CButtonsDlg::OnLeft()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_LEFT);
}
void CButtonsDlg::OnCenter()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_CENTER);
}
void CButtonsDlg::OnRight()
{
// TODO: Add your control notification handler code here
ChangeDialogTitle(IDC_RIGHT);
}
void CButtonsDlgChangeDialogTitle(UINT nID)
{
CString strCaption;
//** Get label of the button that was clicked
GetDlgItem(nID) -> GetWindowText(strCaption);
strCaption += " was pressed";
//**Check if the button is the same as the last time
if(m_nIDofLastButton += nID)
strCaption += " again";
//** Set the caption of the dialog box
setWindowText(strCaption);
//** Store the ID of the clicked button
m_nIDofLastButton = nID;
}
</code>