我是giggleman 2017-02-04 07:08 采纳率: 0%
浏览 1188
已结题

[VS] C++ WIN32, 关于数组的

一个文本有400行(row),我会以一次性直接导出400行在一个listbox中。 那么我如何分4次导出在4个不同的listbox中呢?

这是我的代码。请麻烦主要看看 comman 的代码 谢谢。麻烦改下,或者提下建议
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId)
{

    case BN_CLICKED:        //Capture the button click
    {
        if (LOWORD(lParam) == (WORD)hWnd_Load1) //if load button clicked
        {
            ifstream fInput;//fild handle
            string strLine;     //line from input file

            wchar_t wcOutput[MAX_LOADSTRING];   //output string
            size_t pRetVal;                 // mbstowcs_s return value

            fInput.open(DATAFLIENAME);          //open the input file

            if (fInput.is_open())           // did the file open?

            {
                getline(fInput, strLine);   //get 1st line from input file
                while (fInput.good())       //while not at end of file

                {

                    mbstowcs_s(             //conver string to output format
                        &pRetVal,
                        wcOutput,           //output string
                        MAX_LOADSTRING,     //output size
                        strLine.c_str(),        //input string      
                        MAX_LOADSTRING);    //input size

                    SendMessage(hWnd_ListBox1,  // add string to the line box1
                        LB_ADDSTRING,
                        NULL,
                        LPARAM(wcOutput)
                    );

                    SendMessage(hWnd_ListBox2, // add string to the line box2
                        LB_ADDSTRING,
                        NULL,
                        LPARAM(wcOutput)
                        );

                    SendMessage(hWnd_ListBox3, // add string to the line box3
                        LB_ADDSTRING,
                        NULL,
                        LPARAM(wcOutput)
                    );

                    SendMessage(hWnd_ListBox4, // add string to the line box4
                        LB_ADDSTRING,
                        NULL,
                        LPARAM(wcOutput)
                    );

                    getline(fInput, strLine); //get next line from input file
                }

            }

            fInput.close();             //close the input file


        }

    }break;
  • 写回答

2条回答 默认 最新

  • 我是giggleman 2017-02-04 07:06
    关注

    按一下button键,4个listbox分别各现实100行。 第一个box 显示 1-100 行,
    第二个box显示 101-200 行,
    ===
    ===

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器