// CSetDlgBasic メッセージ ハンドラー BOOL CSetDlgBasic::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ここに初期化を追加してください wstring path; GetSettingPath(path); settingFolderPath = path.c_str(); int iNum = GetPrivateProfileInt( L"SET", L"RecFolderNum", 0, commonIniPath ); if( iNum == 0 ){ GetDefSettingPath(path); recFolderList.AddString( path.c_str() ); }else{ for( int i = 0; i < iNum; i++ ){ CString key = L""; key.Format(L"RecFolderPath%d", i ); WCHAR buff[512]=L""; GetPrivateProfileString( L"SET", key, L"", buff, 512, commonIniPath ); recFolderList.AddString( buff ); } } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // 例外 : OCX プロパティ ページは必ず FALSE を返します。 }
void GetSettingPath(wstring& strPath) { strPath = L""; wstring strIni = L""; GetCommonIniPath(strIni); WCHAR wPath[512]=L""; GetPrivateProfileString( L"Set", L"DataSavePath", L"", wPath, 512, strIni.c_str() ); strPath = wPath; if( strPath.empty() == true ){ GetDefSettingPath(strPath); } ChkFolderPath(strPath); }
void GetSettingPath(wstring& strPath) { wstring strIni = L""; GetCommonIniPath(strIni); WCHAR wPath[MAX_PATH + 8]; GetPrivateProfileString( L"Set", L"DataSavePath", L"", wPath, MAX_PATH + 8, strIni.c_str() ); strPath = wPath; ChkFolderPath(strPath); if( strPath.size() >= MAX_PATH ){ throw std::runtime_error(""); } if( strPath.empty() == true ){ GetDefSettingPath(strPath); } }