CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

Q_O() 谢谢你!请看内容:

楼主feihong6(蓝天飞鸿)2002-04-27 20:56:50 在 VC/MFC / 基础类 提问

源程序:  
  //  
  #   include   <windows.h>  
  //#   include   <iostream.h>  
  LRESULT   CALLBACK   WndProc(HWND,UINT,WPARAM,LPARAM);  
   
  //  
  int   WINAPI   WinMain(HINSTANCE   hInstance,  
        HINSTANCE   hPrevInst,  
        LPSTR         lpszCmdLine,  
        int               nCmdShow)  
  {  
  HWND   hwnd   ;  
  MSG     Msg;  
  WNDCLASS   wndclass;  
  char   lpszClassName[]="窗口";  
  char   lpszTitle[]="My-windows";  
  //  
  wndclass.style=0;  
  wndclass.lpfnWndProc=WndProc;  
  wndclass.cbClsExtra=0;  
  wndclass.cbWndExtra=0;  
  wndclass.hInstance=hInstance;  
  wndclass.hIcon=LoadIcon(NULL,IDI-APPLICATION);  
  wndclass.hCursor=loadCursor(NULL,IDC-ARROW);  
  wndclass.hbrBackground=GetstockObject(WHITE-BRUSH);  
  wndclass.lpszMenuName=NULL;  
  wndclass.lpszClassName=lpszClassName;  
  //  
  if(!RegisterClass(&wndclass))  
  {  
  MessageBeep(0);  
  return   FALSE;  
  }  
  //  
  hwnd=CreateWindow(lpszClassName,  
                              lpszTitle,  
      WS_OVERLAPPEDWINDOW,  
      CW_USEDEFAULT,  
      CW_USEDEFAULT,  
      CW_USEDEFAULT,  
      CW_USEDEFAULT,  
      NULL,  
      NULL,  
      hInstance,  
      NULL);  
  //  
  ShowWindow(hwnd,nCmdShow);  
  //  
  UpdateWindow(hwnd);  
  //  
  while(GetMessage(&Msg,NULL,0,0))  
  {  
  translateMessage(&Msg);  
  dispatchMessage(&Msg);  
  }  
  return   Msg.wParam;  
  }  
  //  
  LRESULT   CALLBACK   WndProc(   HWND   hwnd,  
                                              UINT   message,  
      WPARAM   wParam,  
      LPARAM   lParam)  
  {  
  switch(message)  
  {  
  case   WM_DESTROY:  
  PostQuitMessage(0);  
                  default:  
  return   DefWindowProc(hwnd,message,wParam,lParam);  
  }  
  return(0);  
  }  
             
  编译结果:  
  -Configuration:   ma1   -   Win32   Debug--------------------  
  Compiling...  
  ma1.cpp  
  D:\软件2\vc++\excise\ma1.cpp(23)   :   error   C2065:   'IDI'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(23)   :   error   C2065:   'APPLICATION'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(23)   :   error   C2664:   'LoadIconA'   :   cannot   convert   parameter   2   from   'int'   to   'const   char   *'  
                  Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast  
  D:\软件2\vc++\excise\ma1.cpp(24)   :   error   C2065:   'loadCursor'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(24)   :   error   C2065:   'IDC'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(24)   :   error   C2065:   'ARROW'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(24)   :   error   C2440:   '='   :   cannot   convert   from   'int'   to   'struct   HICON__   *'  
                  Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast  
  D:\软件2\vc++\excise\ma1.cpp(25)   :   error   C2065:   'GetstockObject'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(25)   :   error   C2065:   'WHITE'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(25)   :   error   C2065:   'BRUSH'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(25)   :   error   C2440:   '='   :   cannot   convert   from   'int'   to   'struct   HBRUSH__   *'  
                  Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast  
  D:\软件2\vc++\excise\ma1.cpp(53)   :   error   C2065:   'translateMessage'   :   undeclared   identifier  
  D:\软件2\vc++\excise\ma1.cpp(54)   :   error   C2065:   'dispatchMessage'   :   undeclared   identifier  
  Error   executing   cl.exe.  
   
  ma1.obj   -   13   error(s),   0   warning(s)  
  问题点数:20、回复次数:4Top

1 楼Q_O()回复于 2002-04-27 21:02:26 得分 2

1:   do   u   include   resource.h?  
  2:   loadIcon   second   param   is   a   int   type   .   u   should    
  wndclass.hIcon   =   (HICON)   LoadIcon(NULL,MAKEINTRESOURCE(IDI-APPLICATION));  
    treat   cursor   as   same   way  
  Top

2 楼feihong6(蓝天飞鸿)回复于 2002-04-30 07:20:38 得分 0

我另外的问题在0:54发布的,标题为:"急上加急!!!上班试验期第一天,出问题!请大哥哥帮忙!!!"  
          请大家想办法迅速解救!  
          :(  
  Top

3 楼feihong6(蓝天飞鸿)回复于 2002-04-30 07:26:57 得分 0

补充一句:上面的问题在DELPHI论坛中!Top

4 楼jyu1221(天同)回复于 2002-05-14 15:47:14 得分 18

我来拿分了Top

相关问题

  • happyxiu 谢谢你
  • ExitWindows谢谢你
  • jdy,谢谢你!
  • nowaytogo谢谢你
  • solar,谢谢你
  • sunspot谢谢你!
  • yirenJJ,谢谢你~~
  • 谢谢你!
  • sunspot再谢谢你!
  • 老衲,谢谢你

关键词

  • vc++
  • null
  • wndclass
  • lpszclassname
  • usedefault
  • hinstance
  • cw
  • hwnd
  • msg

得分解答快速导航

  • 帖主:feihong6
  • Q_O
  • jyu1221

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo