你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:杂志经典 / 编程语言
用VC制作迅雷批量下载列表生成器(八)
 

break;

    }

    case 4: //四个通配符时,四层循环

    {

        for (int i=nStart1; i<=nEnd1; i++)

        {

            for (int j=nStart2;j<=nEnd2; j++)

            {

                for (int k=nStart3; k<=nEnd3; k++)

{

                    for (int l=nStart4; l<=nEnd4; l++)

                    {

                        CString strTmp;

                strTmp.Format("%s%d%s%d%s%d%s",str[0],i,str[1],j,str[2],k,str[3]);

                        m_listBox.AddString(strTmp);

                    }

                }

            }

        }

        break;

    }

    default:;

    }

}

4.导出下载列表,为导出列表文件按钮单击消息响应函数添加代码。

void CDownListDlg::OnBtnExportlist()

{

    // TODO: Add your control notification handler code here

    if (m_listBox.GetCount() == 0)

    {

        MessageBox("请先生成列表!");

        return;

    }

    char  szFilter[] = "Down List Files (*.lst)|*.lst|All Files (*.*)|*.*||";

    CFileDialog fdlg(false, "BMP", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);

    if(fdlg.DoModal() != IDOK)//弹出另存为文件对话框

        return;

    CString strFilePath = fdlg.GetPathName();

    CStdioFile file;

    if(!file.Open(strFilePath,CFile::modeCreate|CFile::modeWrite))

    {

        AfxMessageBox("保存失败!");

        return;

    }

CString str;

    file.SeekToBegin();//将文件定位到文件开头

    for (int i=0; i<m_listBox.GetCount(); i++)

{

m_listBox.GetText(i,str);//ListBox中获取字符串

    file.WriteString(str + "\n");//将字符串写入文件中

    }

    file.Close();

    MessageBox("导出成功!");

}

  推荐精品文章

·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录
·2023年10月目录
·2023年9月目录 
·2023年8月目录 
·2023年7月目录
·2023年6月目录 
·2023年5月目录
·2023年4月目录 
·2023年3月目录 
·2023年2月目录 
·2023年1月目录 

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089