• Register

Solution:

To solve this problem employ SetDlgItemInt at the time dialog received WM_INITDIALOG message:

Follw this below program:

LRESULT CALLBACK CheckOptionsProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_INITDIALOG:
        SetDlgItemInt(hDlg, ID_EDIT_OPTIONS_BOX, testInt, FALSE);
        break;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case ID_EDIT_OPTIONS_OK:
            testInt = GetDlgItemInt(hDlg, ID_EDIT_OPTIONS_BOX, NULL, FALSE);
            EndDialog(hDlg, IDOK);
            break;
        }
    }
    return 0;
}

Then you have to initialize testInt:

int testInt = 30;

 

posted Jul 4 in c++ 17,260 points