| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1522 人关注过本帖
标题:windows界面问题
只看楼主 加入收藏
za30312
Rank: 1
等 级:新手上路
帖 子:13
专家分:4
注 册:2016-5-16
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:2 
windows界面问题
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct product
{
    char ID[100];   //质检编号
    char producers[20]; //生产者
    char name[20];   //零部件名称
    char department[20]; //生产部门
    char lookjieguo[20]; //质检结果
    char lookwenti[20]; //质量问题
    char lookers[20];  //质检员
    char year[5]; //年
    char month[5]; //月
    char day[5]; //日
    struct product* next;
}PRO;
LRESULT WINAPI WinProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);//函数声明
void add();
int existNode(PRO *node);
void insertBack(PRO *p);
void freeList();
PRO* findBack();
void query();
PRO* findByName(char *ID);
void clean();
void dispaly();
void dispaly(HWND hWnd,PRO *p);
void del();
void mdy();
void output();
void input();
void tongji();

PRO head;        //头结点
PRO ss;
RECT rect,rect2,rect3,rect4,rect5,rect6,rect7,rect8,rect9,rect10,rect11,rect12,rect13;
int i,j=0;  //循环变量
HDC hDC;
PAINTSTRUCT paint;
HWND hWnd;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{   
    head.next=NULL;
    char *cName = "myWindow";//定义个字符指针表示窗口类的名字
    WNDCLASS wc;//定义变量
    MSG Msg;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);;//设置窗口背景为白色
    wc.hCursor = NULL;//窗口的光标不设置
    wc.hIcon = NULL;//窗口图标设置
    wc.hInstance = hInstance;//当前程序的句柄,hInstance是由主函数传递
    wc.lpfnWndProc = WinProc;//窗口处理过程的窗口函数。
    wc.lpszClassName =(LPSTR)cName;//窗口类的名字。
    wc.lpszMenuName = NULL;//目录名,不设置
    wc.style = CS_HREDRAW | CS_VREDRAW; //窗口类的风格
    RegisterClass(&wc);//在系统中注册窗口
    hWnd = CreateWindow(cName,TEXT("窗口的标题"),WS_OVERLAPPEDWINDOW,50, 20, 800, 600,            
                      NULL, NULL, hInstance, NULL) ;
     ShowWindow(hWnd,nShowCmd);//显示窗口
     UpdateWindow(hWnd);//更新窗口
     while(GetMessage(&Msg,NULL,0,0))
    {
        TranslateMessage(&Msg);//翻译消息
        DispatchMessage(&Msg);//分派消息
    }
    return Msg.message;//程序结束后返回消息
}
LRESULT WINAPI WinProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{//处理消息过程
 static HWND btnHwnd ;
 static HWND inputHwnd ;
    switch(Msg)//对消息进行判断
    {
 case WM_PAINT:
  hDC=BeginPaint(hWnd,&paint);//获取设备上下文
  rect.top=20;//设置矩形框的属性
  rect.right=20;
  rect.bottom=40;
  rect.left=90;

  rect2.top=20;
  rect2.right=5;
  rect2.bottom=130;
  rect2.left=110;

  rect3.top=20;
  rect3.right=5;
  rect3.bottom=130;
  rect3.left=750;
  
  rect4.top=20;
  rect4.right=0;
  rect4.bottom=220;
  rect4.left=110;

  rect5.top=20;
  rect5.right=20;
  rect5.bottom=220;
  rect5.left=750;

  rect6.top=20;
  rect6.right=20;
  rect6.bottom=310;
  rect6.left=110;

  rect7.top=20;
  rect7.right=20;
  rect7.bottom=310;
  rect7.left=750;

  rect8.top=20;
  rect8.right=20;
  rect8.bottom=400;
  rect8.left=110;

  rect9.top=20;
  rect9.right=20;
  rect9.bottom=400;
  rect9.left=750;

  rect10.top=20;
  rect10.right=20;
  rect10.bottom=490;
  rect10.left=110;

  rect11.top=20;
  rect11.right=300;
  rect11.bottom=400;
  rect11.left=750;

  rect12.top=20;
  rect12.right=425;
  rect12.bottom=400;
  rect12.left=750;

  rect13.top=20;
  rect13.right=550;
  rect13.bottom=400;
  rect13.left=750;

  DrawText(hDC,"文件:",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"质检编号:",-1,&rect2,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"生产者:",-1,&rect3,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"零部件名称:",-1,&rect4,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"生产部门:",-1,&rect5,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"质检结果:",-1,&rect6,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"质量问题:",-1,&rect7,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"质量员:",-1,&rect8,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"质量日期:",-1,&rect9,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"结果:",-1,&rect10,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"年",-1,&rect11,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"月",-1,&rect12,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  DrawText(hDC,"日",-1,&rect13,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
  EndPaint(hWnd,&paint);
  return 0;
  
 case WM_CREATE: //响应窗口的创建事件
  //创建按钮
  btnHwnd = CreateWindow( TEXT("button"), TEXT("导入"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   50, 350, 60, 30, hWnd, (HMENU)10, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("添加"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   140, 350, 60, 30, hWnd, (HMENU)11, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("查找"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   230, 350, 60, 30, hWnd, (HMENU)12, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("删除"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   320, 350, 60, 30, hWnd, (HMENU)13, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("统计"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   410, 350, 60, 30, hWnd, (HMENU)14, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("修改"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   500, 350, 60, 30, hWnd, (HMENU)15, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  btnHwnd = CreateWindow( TEXT("button"), TEXT("保存"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,   590, 350, 60, 30, hWnd, (HMENU)16, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE ), NULL ) ;
  //创建文本框
  /*文件框22*/inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_LEFT | ES_MULTILINE , 110, 20,550, 20, hWnd, (HMENU)22, ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  for(i=0;i<4;i++)
  {
   inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_LEFT | ES_MULTILINE , 110, 65+45*i, 220, 20, hWnd, (HMENU)(i+1), ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  }
  for(i=0;i<3;i++)
  {
   inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_LEFT | ES_MULTILINE , 440, 65+45*i, 220, 20, hWnd, (HMENU)(i+5), ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  }
  /*年77*/inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_RIGHT | ES_MULTILINE , 440, 65+45*3, 70, 20, hWnd, (HMENU)77, ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  /*月88*/inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_RIGHT| ES_MULTILINE , 535, 65+45*3, 40, 20, hWnd, (HMENU)88, ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  /*日99*/inputHwnd = CreateWindow( TEXT("edit"), NULL,WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_RIGHT | ES_MULTILINE , 600, 65+45*3, 40, 20, hWnd, (HMENU)99, ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;
  /*大框44*/inputHwnd = CreateWindow( TEXT("edit"), NULL, WS_VSCROLL|WS_CHILD | WS_VISIBLE  | WS_BORDER |ES_LEFT | ES_MULTILINE|ES_WANTRETURN, 110, 250, 550, 90, hWnd, (HMENU)44, ((LPCREATESTRUCT) lParam) -> hInstance,NULL ) ;

  return 0 ;
 case WM_COMMAND://响应命令
     {   
         SetDlgItemText(hWnd,44,NULL);
         switch(LOWORD(wParam))
         {
         case 10:// 是ID号为11的按钮点击 导入
             {                     
                 input();
                 break;
             }
         case 11:// 是ID号为11的按钮点击 添加
             {                     
                 add();
                 break;
             }
         case 12:// 是ID号为12的按钮点击 查找
             {                 
                 query();
                 break;
             }
         case 13:// 是ID号为12的按钮点击 删除
             {                 
                 del();
                 break;
             }
        case 14:// 是ID号为12的按钮点击 统计
             {                 
                 tongji();
                 break;
             }
        case 15:// 是ID号为12的按钮点击 修改
             {         
                 mdy();
                 break;
             }
        case 16:// 是ID号为12的按钮点击 保存
             {
                 output();
                 break;
             }
         }
        return 0;
     }
         case WM_DESTROY://如果是点击关闭窗口时的消息
             PostQuitMessage(0);//退出消息队列
             return 0;//返回0,结束函数
     }
     //如果是其余的消息,调用默认消息处理函数,将消息该函数处理并将返回值返回
     return DefWindowProc(hWnd,Msg,wParam,lParam);
}
void tongji()            //统计
{
    PRO *p,*pre;
    int a=0,b=0,c=0,d=0,e=0;
    char aa[4],bb[4],cc[4],dd[4],ee[4];
    char str1[40]="质检结果不合格数量:";
    char str2[40]="质检设计缺陷问题数量:";
    char str3[40]="质检装配质量问题数量:";
    char str4[40]="质检加工质量问题数量:";
    pre=&head;        //pre指向头结点
    p=head.next;    //p指向第一个结点
    while(p!=NULL)
    {   
        e++;
        GetDlgItemText(hWnd,3,p->lookjieguo,sizeof(p->lookjieguo)/sizeof(char));
        GetDlgItemText(hWnd,7,p->lookwenti,sizeof(p->lookwenti)/sizeof(char));
        if(strcmp(p->lookjieguo,"不合格")==1)   a++; //质检结果不合格 a+1  结果3
        if(strcmp(p->lookwenti,"设计缺陷")==1)   b++;  //问题7
        if(strcmp(p->lookwenti,"装配质量")==1)   b++;
        if(strcmp(p->lookwenti,"加工质量")==1)   c++;
        pre=pre->next;    //p pre指向下一个结点 pre在p之前
        p=p->next;
        
    }
    itoa(a, aa, 10);
    itoa(b, bb, 10);
    itoa(c, cc, 10);
    itoa(d, dd, 10);
    itoa(e, ee, 10);
    strcat(str1,aa);
    strcat(str1,"\r\n");
    strcat(str1,str2);
    strcat(str1,bb);
    strcat(str1,"\r\n");
    strcat(str1,str3);
    strcat(str1,cc);
    strcat(str1,"\r\n");
    strcat(str1,str4);
    strcat(str1,dd);
    SetDlgItemText(hWnd,44,str1);
}
void input()
{
    FILE *fp;
    PRO *p;
    int count;
    char filename[20];
    GetDlgItemText(hWnd,22,filename,sizeof(filename)/sizeof(char));
    fp=fopen(filename,"r");
    if(fp==NULL)
    {
        SetDlgItemText(hWnd,44,"文件打开失败!");
        return;
    }
    while(!feof(fp))
    {
        p=(PRO*)malloc(sizeof(PRO));
        count=fscanf(fp,"%10s%10s%10s%10s%10s%10s%10s%5s%5s%5s",p->ID,p->lookers,p->lookjieguo,p->lookwenti,p->producers,p->name,p->department
            ,p->year,p->month,p->day);
        if(count<10)
        {
            free(p);
            break;
        }
        if(existNode(p))
        {
            SetDlgItemText(hWnd,44,"存在相同质检信息");
            free(p);
        }
        else
        {
            insertBack(p);
            SetDlgItemText(hWnd,44,"导入成功");
        }
    }
    fclose(fp);
    SetDlgItemText(hWnd,44,"导入成功");
    return;
}
void output()
{
    FILE *fp;
    PRO *p;
    char filename[20];
    GetDlgItemText(hWnd,22,filename,sizeof(filename)/sizeof(char));
    fp=fopen(filename,"w");
    if(fp==NULL)
    {
        SetDlgItemText(hWnd,44,"文件打开失败");
        return;
    }
    p=head.next;    /*p指向第一个结点*/
    while(p!=NULL)
    {
        fprintf(fp,"%10s%10s%10s%10s%10s%10s%10s%5s%5s%5s\n",p->ID,p->lookers,p->lookjieguo,p->lookwenti,p->producers,p->name,p->department,p->year,p->month,p->day);
        p=p->next;
    }
    SetDlgItemText(hWnd,44,"保存成功!");
    fclose(fp);
    return;
}
void mdy()
{
    PRO *p,temp;
    GetDlgItemText(hWnd,1,temp.ID,sizeof(temp.ID)/sizeof(char));
    GetDlgItemText(hWnd,2,temp.name,sizeof(temp.name)/sizeof(char));
    GetDlgItemText(hWnd,3,temp.lookjieguo,sizeof(temp.lookjieguo)/sizeof(char));
    GetDlgItemText(hWnd,4,temp.lookers,sizeof(temp.lookers)/sizeof(char));
    GetDlgItemText(hWnd,5,temp.producers,sizeof(temp.producers)/sizeof(char));
    GetDlgItemText(hWnd,6,temp.department,sizeof(temp.department)/sizeof(char));
    GetDlgItemText(hWnd,7,temp.lookwenti,sizeof(temp.lookwenti)/sizeof(char));
    GetDlgItemText(hWnd,77,temp.year,sizeof(temp.year)/sizeof(char));
    GetDlgItemText(hWnd,88,temp.month,sizeof(temp.month)/sizeof(char));
    GetDlgItemText(hWnd,99,temp.day,sizeof(temp.day)/sizeof(char));
   
    p=findByName(temp.ID);    //查找NO对应的结点地址
    strcpy(p->ID,temp.ID);
    strcpy(p->name,temp.name);
    strcpy(p->lookjieguo,temp.lookjieguo);
    strcpy(p->lookers,temp.lookers);
    strcpy(p->producers,temp.producers);
    strcpy(p->department,temp.department);
    strcpy(p->lookwenti,temp.lookwenti);
    strcpy(p->year,p->year);
    strcpy(p->month,p->month);
    strcpy(p->day,p->day);
    SetDlgItemText(hWnd,44,"修改成功!");
    clean();
}
void query()
{
    PRO *p;
    char ID[20];
    GetDlgItemText(hWnd,1,ID,sizeof(ID)/sizeof(char));
    p=findByName(ID);    //查找
    if(p==NULL)
    {
        SetDlgItemText(hWnd,44,"质检编号不存在");
    }
    else
    {
        dispaly(hWnd,p);
    }
}
void del()            //删除
{
    PRO *p,*pre;
    char ID[20];
    GetDlgItemText(hWnd,1,ID,sizeof(ID)/sizeof(char));
    pre=&head;        //pre指向头结点
    p=head.next;    //p指向第一个结点
    while(p!=NULL)
    {
        if(strcmp(p->ID,ID)==0)   break;
        pre=pre->next;    //p pre指向下一个结点 pre在p之前
        p=p->next;
    }
    if(p!=NULL)        //如果找到
    {
        pre->next=p->next;    //将p所指向的结点从链表删除
        free(p);
        clean();
        SetDlgItemText(hWnd,44,"删除成功");
        return;
    }
    else
    {
        SetDlgItemText(hWnd,44,"编号不存在,没能删除");
    }
    clean();
    return;
}
void add()
{   
    int d1,d2,d3;
    PRO *p;
    p=(PRO *)malloc(sizeof(PRO));    /*新建结点*/
    if(p==NULL)
    {
        SetDlgItemText(hWnd,44,"动态内存分配失败!");
        return;
    }
    ZeroMemory(p->ID,sizeof(p->ID));
    GetDlgItemText(hWnd,1,p->ID,sizeof(p->ID)/sizeof(char));
    GetDlgItemText(hWnd,2,p->name,sizeof(p->name)/sizeof(char));
    GetDlgItemText(hWnd,3,p->lookjieguo,sizeof(p->lookjieguo)/sizeof(char));
    GetDlgItemText(hWnd,4,p->lookers,sizeof(p->lookers)/sizeof(char));
    GetDlgItemText(hWnd,5,p->producers,sizeof(p->producers)/sizeof(char));
    GetDlgItemText(hWnd,6,p->department,sizeof(p->department)/sizeof(char));
    GetDlgItemText(hWnd,7,p->lookwenti,sizeof(p->lookwenti)/sizeof(char));
    GetDlgItemText(hWnd,77,p->year,sizeof(p->year)/sizeof(char));
    GetDlgItemText(hWnd,88,p->month,sizeof(p->month)/sizeof(char));
    GetDlgItemText(hWnd,99,p->day,sizeof(p->day)/sizeof(char));
    d1 = atoi(p->year);
    d2 = atoi(p->month);
    d3 = atoi(p->day);

   
    if(d1>2016||d1<0)
    {   
        SetDlgItemText(hWnd,44,"年份错误,请重新输出");
        return;
    }
   
    if(d2>12||d2<1)
    {   
        SetDlgItemText(hWnd,44,"月份错误,请重新输出");
        return;
    }
   
    if(d2==4||d2==6||d2==9||d2==11)   
    {
        if(d3<1||d3>30)
        {
            SetDlgItemText(hWnd,44,"日份错误,请重新输出");
            return;
        }
    }
    if(d2==1||d2==3||d2==5||d2==7||d2==8||d2==10||d2==12)   
    {   
        if(d3<1||d3>31)
        {
            SetDlgItemText(hWnd,44,"日份错误,请重新输出");
            return;
        }
    }
    if(d2==2)
    {
        if(((d1%4==0)&&(d1%100!=0))||(d1%400==0))  
        {
            if(d3<1&&d3>29)
            {
                SetDlgItemText(hWnd,44,"日份错误,请重新输出");   
                return;
            }
        }
    }
    if(existNode(p))
    {
        SetDlgItemText(hWnd,44,"存在相同的质检编号");
    }
    else
    {
        insertBack(p);        //在链表后面插入一个结点
        SetDlgItemText(hWnd,44,"添加成功!");   
    }
    clean();
    return;
}

// ZeroMemory(ss.ID,sizeof(ss.ID));
  //获取文本框中内容
 //GetDlgItemText(hWnd,2,ss.ID,sizeof(ss.ID)/sizeof(char));
/*
函数功能:判断参数表示的产品信息结点是否在链表中已经存在
人口参数:node表示产品信息的结点   
返回值:若找到返回1,否则返回0
*/
int existNode(PRO *node)
{
    PRO *p;
    p=head.next;    //p指向第一个结点
    while(p!=NULL)    //当p不为NULL
    {
        if(strcmp(p->ID,node->ID)==0)    return 1;
        p=p->next;    //p指向下一个结点
    }
    return 0;
}
/*
函数功能:查找尾结点的地址
返回值:存放尾结点的地址
*/
PRO* findBack()
{
    PRO *p;
    p=&head;
    while(p->next!=NULL)
    {
        p=p->next;    //p指向下一个结点
    }
    return p;
}
/*
函数功能:使用尾插法在链表后面插入一个结点
人口参数:p为待插入的结点地址
*/
void insertBack(PRO *p)
{
    PRO *tail;
    tail=findBack();
    tail->next=p;
    p->next=NULL;
    return;
}
/*
函数功能:释放链表中所有存放产品信息的结点
*/
void freeList()
{
    PRO *p;
    p=head.next;    //p指向第一个结点
    while(p!=NULL)    //如果p不为NULL
    {
        head.next=p->next;    //保存p的下一个结点的地址
        free(p);            //释放p指向的存储单元
        p=head.next;        //将p指向下一个结点
    }
    return;
}
/*
函数功能:根据姓名查找存放通讯录信息结点的地址
人口参数:ID为质检编号
返回值:若找到,返回存放质检信息结点的地址,否则返回NULL
*/
PRO* findByName(char *ID)
{
    PRO *p;
    p=head.next;
    while(p!=NULL)
    {
        if(strcmp(p->ID,ID)==0)    break;
        p=p->next;    //指向下个结点
    }
    return p;
}
void clean()
{
    SetDlgItemText(hWnd,1,NULL);//在文本框中显示
    SetDlgItemText(hWnd,2,NULL);
    SetDlgItemText(hWnd,3,NULL);
    SetDlgItemText(hWnd,4,NULL);
    SetDlgItemText(hWnd,5,NULL);
    SetDlgItemText(hWnd,6,NULL);
    SetDlgItemText(hWnd,7,NULL);
    SetDlgItemText(hWnd,77,NULL);
    SetDlgItemText(hWnd,88,NULL);
    SetDlgItemText(hWnd,99,NULL);
}
void dispaly(HWND hWnd,PRO *p)    //显示
{
    SetDlgItemText(hWnd,1,p->ID);//在文本框中显示
    SetDlgItemText(hWnd,2,p->name);
    SetDlgItemText(hWnd,3,p->lookjieguo);
    SetDlgItemText(hWnd,4,p->lookers);
    SetDlgItemText(hWnd,5,p->producers);
    SetDlgItemText(hWnd,6,p->department);
    SetDlgItemText(hWnd,7,p->lookwenti);
    SetDlgItemText(hWnd,77,p->year);
    SetDlgItemText(hWnd,88,p->month);
    SetDlgItemText(hWnd,99,p->day);
}
统计的地方我用SetDlgItemText一直不行  我已经设置多行了   现在是一点就直接退出了  为什么呢?  
搜索更多相关主题的帖子: 零部件 include windows department product 
2016-07-07 10:44
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9024
专家分:54030
注 册:2011-1-18
收藏
得分:20 
void tongji()
{
    ……
    char str1[40]="质检结果不合格数量:";
    ……
    strcat(str1,aa);
    strcat(str1,"\r\n");
    strcat(str1,str2);
    strcat(str1,bb);
    strcat(str1,"\r\n");
    strcat(str1,str3);
    strcat(str1,cc);
    strcat(str1,"\r\n");
    strcat(str1,str4);

你有没有想过str1会溢出?
2016-07-07 11:23
za30312
Rank: 1
等 级:新手上路
帖 子:13
专家分:4
注 册:2016-5-16
收藏
得分:0 
回复 2楼 rjsp
可以帮我看看 统计后比较字符串那  为什么得不到想要的答案吗?
if(strcmp(p->lookjieguo,"不合格")==1)   a++;
if(strcmp(p->lookwenti,"设计缺陷")==1)   b++;  
if(strcmp(p->lookwenti,"装配质量")==1)   b++;
if(strcmp(p->lookwenti,"加工质量")==1)   c++;
2016-07-07 19:23
快速回复:windows界面问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042127 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved