看一段源代码的疑惑???
源代码如下:
CChildView::CChildView()
{
srand( GetTickCount() );
m_bmCells.LoadBitmap( IDB_CELLS );
m_bmFaces.LoadBitmap( IDB_FACES );
m_bmNumber.LoadBitmap( IDB_NUM );
//此处存在疑问
m_level = AfxGetApp()->GetProfileInt( szSection, "Difficulty", 0 );
if( m_level >= 3 ) // customize
{
m_height = AfxGetApp()->GetProfileInt( szSection, "Height", 8 );
m_width = AfxGetApp()->GetProfileInt( szSection, "Width", 8 );
m_nMines = AfxGetApp()->GetProfileInt( szSection, "Mines", 10 );
}
m_bMark = AfxGetApp()->GetProfileInt( szSection, "Mark", 1 );
for( int i = 0; i < 3; i ++ )
{
CString strEntry;
strEntry.Format( "Time%d", i + 1 );
m_recordTime[i] = AfxGetApp()->GetProfileInt( szSection, strEntry, 999 );
strEntry.Format( "Name%d", i + 1 );
m_recordName[i] = AfxGetApp()->GetProfileString( szSection, strEntry, "匿名" );
}
}
疑问如下:
GetProfileInt(**,**,**)是从注册表中读取数据(在CChildView::~CChildView()中有写入注册表的代码),但我想在程序第一次运行时,注册表里面还没有相应的数据,那么读出来得会不会是错误的数据啊???