主题:[原创]急啊!!! WIN32SDK 方面的问题关于listbox的
//读取data里面的数据..
struct StudentNode* Load(void)
{
char ID[10] = "";
char Name[21] = "";
char Computer[4] = "";
char Math[4] = "";
char English[4] = "";
FILE* fp = fopen("data.txt","r");
if (fp == NULL)
{
::MessageBox(NULL,"失败!!!","呵呵",MB_OK);
}
else
{
while(feof(fp) == 0)
{
//从data里面读取数据
fscanf(fp ,"%s\t%s\t%s\t%s\t%s\n",ID,Name,Computer,Math,English);
node = (struct StudentNode*)malloc( sizeof(struct StudentNode) );
strcpy(node->StuID,ID);
strcpy(node->StuName,Name);
strcpy(node->StuComputer,Computer);
strcpy(node->StuEnglish,English);
strcpy(node->StuMath,Math);
node->next = NULL;
//把读取的数据发送给listbox,问题就在这里....
::SendMessage(HidList ,LB_ADDSTRING ,0 , (LPARAM)node->StuID);
::SendMessage(HnameList ,LB_ADDSTRING ,0 , (LPARAM)node->StuName);
::SendMessage(HcomList ,LB_ADDSTRING ,0 , (LPARAM)node->StuComputer);
::SendMessage(HengList ,LB_ADDSTRING ,0 , (LPARAM)node->StuEnglish);
::SendMessage(HmathList ,LB_ADDSTRING ,0 , (LPARAM)node->StuMath);
//把读取的数据建立链表
if (head == NULL)
{
head = tail = node;
::MessageBox(NULL,"1","呵呵",MB_OK);
}
else
{
tail->next = node;
tail = node;
::MessageBox(NULL,"2","呵呵",MB_OK);
}
}
::MessageBox(NULL,"成功!!!","呵呵",MB_OK);
}
fclose(fp);
return (head);
}
数据不能够在 listbox上面显示啊
我的listbox在是主窗体上..不在DLG上
struct StudentNode* Load(void)
{
char ID[10] = "";
char Name[21] = "";
char Computer[4] = "";
char Math[4] = "";
char English[4] = "";
FILE* fp = fopen("data.txt","r");
if (fp == NULL)
{
::MessageBox(NULL,"失败!!!","呵呵",MB_OK);
}
else
{
while(feof(fp) == 0)
{
//从data里面读取数据
fscanf(fp ,"%s\t%s\t%s\t%s\t%s\n",ID,Name,Computer,Math,English);
node = (struct StudentNode*)malloc( sizeof(struct StudentNode) );
strcpy(node->StuID,ID);
strcpy(node->StuName,Name);
strcpy(node->StuComputer,Computer);
strcpy(node->StuEnglish,English);
strcpy(node->StuMath,Math);
node->next = NULL;
//把读取的数据发送给listbox,问题就在这里....
::SendMessage(HidList ,LB_ADDSTRING ,0 , (LPARAM)node->StuID);
::SendMessage(HnameList ,LB_ADDSTRING ,0 , (LPARAM)node->StuName);
::SendMessage(HcomList ,LB_ADDSTRING ,0 , (LPARAM)node->StuComputer);
::SendMessage(HengList ,LB_ADDSTRING ,0 , (LPARAM)node->StuEnglish);
::SendMessage(HmathList ,LB_ADDSTRING ,0 , (LPARAM)node->StuMath);
//把读取的数据建立链表
if (head == NULL)
{
head = tail = node;
::MessageBox(NULL,"1","呵呵",MB_OK);
}
else
{
tail->next = node;
tail = node;
::MessageBox(NULL,"2","呵呵",MB_OK);
}
}
::MessageBox(NULL,"成功!!!","呵呵",MB_OK);
}
fclose(fp);
return (head);
}
数据不能够在 listbox上面显示啊
我的listbox在是主窗体上..不在DLG上