程序在启动时
还应该从recode.URL文件中读取浏览过的网址,
并添加到地址栏的下拉列表框中
供用户查看
该功能在函数CMainFrame::OnCreate()中实现,
因为该函数是程序启动后的第一个调用的函数
代码如下
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...//省略部分代码
CFile file("recode.URL",CFile::modeReadWrite); //创建文件
char buff[100]={0}; //定义缓冲区,
file.Read(buff,100); //读取文件,
while(buff!="\r"&&buff!="\n") //判断地址是否结束,
{
GetDlgItem(IDC_COMBO1)->AddString(CString &buff); //向地址栏添加网址
file.Read(buff,100); //继续读取文件内容。
}
}