Start New Discussion within our Software Development Community

I am working on a Windows application, and I have a Settings Dialog box with 5 text fields. I currently get the values of each text field with:

  GetDlgItemText(hDlg, IDC_EDIT_SIPADDRESS, sipAccount->sipAddress, 80);      
  GetDlgItemText(hDlg, IDC_EDIT_USERNAME, sipAccount->userName, 80);      
  GetDlgItemText(hDlg, IDC_EDIT_PASSWORD, sipAccount->password, 80);      
  GetDlgItemText(hDlg, IDC_EDIT_HOST, sipAccount->host, 80);
  GetDlgItemText(hDlg, IDC_EDIT_STUN, stun, 80);

And then set the appropriate Registry keys to save the values. But how do I check if a new value has been put into the text box? (e.g. I want to ensure that it is not trying to set a blank value)

  //do nothing - Registry Key will be set to current value

Also, when I initialize the dialog box, how can I get text to appear in the text fields? I want the current value of that characteristic to be in the box upon initialization. I currently set up the box like:

std::wstring wsSIPAddress = RegistryHelper::ReadRegKeyW(HKEY_CURRENT_USER, L"path", L"sipaddress");
if(wsSIPAddress.length() == 0)
    memset(sipAccount->sipAddress, 0, 80);
    memcpy(sipAccount->sipAddress, wsSIPAddress.c_str(), wsSIPAddress.length() + 1);
SetDlgItemText(dialogHandle, IDC_EDIT_SIPADDRESS, sipAccount->sipAddress);