iamthesgt 0 Junior Poster

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)

if(!text_box_is_empty)
  GetDlgItemText(...);
else
  //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);
else
    memcpy(sipAccount->sipAddress, wsSIPAddress.c_str(), wsSIPAddress.length() + 1);
SetDlgItemText(dialogHandle, IDC_EDIT_SIPADDRESS, sipAccount->sipAddress);