一个文本有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;