I am running a program created using Visual C++ 2010 Express.
I have several dialog boxes to read input data.
One works perfectly, but a second one simply does not read any data at all, and I cannot figure out why.
The two dialogs are defined as
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG5 DIALOG 0, 0, 275, 95
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Enter Start and End Date"
FONT 8, "Ms Shell Dlg"
{
DEFPUSHBUTTON "OK", IDOK, 218, 9, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 218, 30, 50, 14
EDITTEXT IDC_EDIT1, 11, 17, 36, 18, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT2, 53, 17, 88, 18, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT3, 147, 17, 57, 18, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT4, 12, 55, 36, 18, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT5, 54, 55, 88, 18, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT6, 148, 55, 57, 18, ES_AUTOHSCROLL
}
IDD_DIALOG6 DIALOG 0, 0, 227, 105
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Date for Chart"
FONT 8, "Ms Shell Dlg"
{
DEFPUSHBUTTON "OK", IDOK, 166, 5, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 166, 26, 50, 14
EDITTEXT IDC_EDIT7, 14, 20, 71, 16, ES_AUTOHSCROLL
EDITTEXT IDC_EDIT8, 95, 20, 44, 16, ES_AUTOHSCROLL
AUTORADIOBUTTON "Monthly", ID_CHECKBOXM, 20, 50, 41, 8, WS_GROUP | WS_CHILD | WS_VISIBLE | WS_TABSTOP
AUTORADIOBUTTON "Quarterly", ID_CHECKBOXQ, 20, 65, 44, 8, WS_CHILD | WS_VISIBLE
AUTORADIOBUTTON "Six Months", ID_CHECKBOX6, 20, 80, 51, 8, WS_CHILD | WS_VISIBLE
}
The first dialog works perfectly and I can read the six data values without any problem.
Analysis of the second box shows that the two value are both NULL strings and 'value' is always set to SIXMONTHS.
The code used to read the dialog is
GetDlgItemTextA(hDlg, IDC_EDIT7, mx, SMALL);
GetDlgItemTextA(hDlg, IDC_EDIT8, yx, SMALL);
FindMonth(mx, &mxx); // Convert character month to numeric
sscanf_s(yx, "%d", &yxx);
dd2 = DateOfEnd(mxx, yxx); // Determine end date of month
Number2 = DayNumber(yxx, mxx, dd2);
MyDates->day2 = dd2;
MyDates->month2 = mxx;
MyDates->year2 = yxx;
MyDates->DayNumber2 = Number2;
fprintf(fp1, "ReadFinalMonth: TO - %d %d %d %ld\n", dd2, mxx, yxx, Number2);
fflush(fp1);
// if (mx[0])
// {
/* Check if Quarterly, Monthly or 6 months*/
if (IsDlgButtonChecked(hDlg, ID_CHECKBOXM) == BST_CHECKED)
{
LastOption = value;
value = MONTHLY;
CheckOne = ID_CHECKBOXM;
}
else if (IsDlgButtonChecked(hDlg, ID_CHECKBOXQ) == BST_CHECKED)
{
LastOption = value;
value = QUARTERLY;
CheckOne = ID_CHECKBOXQ;
}
else
{
LastOption = value;
value = SIXMONTHS;
CheckOne = ID_CHECKBOX6;
}
Can someone suggest why this is not working?