CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C++ 语言

求救!!太多错误

楼主jonnylin()2005-04-02 23:55:06 在 C/C++ / C++ 语言 提问

#include   <windows.h>  
  #include   <string.h>  
  #include   <stdlib.h>  
  #include   <stdio.h>  
  int   nMode;  
  LERSULT   CALLBACK   WndProc(HWND,UINT,WPARAM,LPARAM);  
   
  int   WINAPI   WinMain(HINSTANCE   hIstance,HINSTANCE   hPrevInst,LPSTR   lpszCmdLine,int   ncmdShow)  
  {  
      HWND   hwnd;  
      MSG   Msg;  
      WNDCLASS   wndclass;  
      char   lpszClassName[]="映射模式";  
      char   lpszTitle[]="My_Map_Mode";  
      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=(HBRUSH)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,NULL,NULL,hInstance,NULL);  
      ShowWindow(hwnd,nCmdShow);  
      UpateWindow(hwnd);  
      while(GetMessage(&Msg,NULL,0,0))  
      {  
          TranslateMessage(&Msg);  
  DispatchMessaga(&Msg);  
     
      }  
      return   Msg.wParam;  
  }  
   
  LRESULT   CALLBACK   WndProc(HWND   hwnd,UINT   message,WPARAM   wParam,LPARAM   lParam)  
  {  
        HDC   hdc;  
        PAINTSTRUCT   ps;  
        HBRUSH   hB1,hB2;  
        switch(message)  
        {  
            case   WM_LBUTTONDOWN:  
                                                    nMode=MM_ISOTROPIC;  
    InvalidateRect(hwnd,NULL,1);  
    break;  
            case   WM_RBUTTONDOWN:  
                                    nMode=MM_ANISOTROPIC;  
    InvalidateRect(hwnd,NULL,1);  
    break;  
            case   WM_PAINT:  
                      hdc=BeginPaint(hwnd,&ps);  
      SetMapMode(hdc,nMode);  
      SetWindowExtEx(hdc,150,150,NULL);  
      SetViewportExtEx(hdc,150,100,NULL);  
      SetViewPortOrgEx(hdc,150,60,NULL);  
      hB1=(HBRUSH)GetStockObject(WHITE_BRUSH);  
      hB2=(HBRUSH)GetStockObject(BLACK_BRUSH);  
      SelectObject(hdc,hB1);  
      RoundRect(hdc,0,0,150,150,30,30);  
      SelectObject(hdc,hB2);  
                      Ellipse(hdc,0,10,150,140);  
      EndPaint(hwnd,&ps);  
      DeleteObject(hB2);  
      DeleteObject(hB1);  
      break;  
    case   WM_DESTROY:  
      PostQuitMessage(0);  
      break;  
            default:  
      return(DefWindowProc(hwnd,message,wParam,lParam));  
   
        }  
        return   0;  
   
  }  
   
  编译时出现这么多的错误,我是新手,实在没法改  
   
   
   
  G:\My_Workspaces\map.cpp(6)   :   error   C2143:   syntax   error   :   missing   ';'   before   '__stdcall'  
  G:\My_Workspaces\map.cpp(6)   :   error   C2501:   'LERSULT'   :   missing   storage-class   or   type   specifiers  
  G:\My_Workspaces\map.cpp(16)   :   error   C2440:   '='   :   cannot   convert   from   'int   (__stdcall   *)(struct   HWND__   *,unsigned   int,unsigned   int,long)'   to   'long   (__stdcall   *)(struct   HWND__   *,unsigned   int,unsigned   int,long)'  
                  This   conversion   requires   a   reinterpret_cast,   a   C-style   cast   or   function-style   cast  
  G:\My_Workspaces\map.cpp(19)   :   error   C2065:   'hInstance'   :   undeclared   identifier  
  G:\My_Workspaces\map.cpp(19)   :   error   C2440:   '='   :   cannot   convert   from   'int'   to   'struct   HINSTANCE__   *'  
                  Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast  
  G:\My_Workspaces\map.cpp(31)   :   warning   C4003:   not   enough   actual   parameters   for   macro   'CreateWindowA'  
  G:\My_Workspaces\map.cpp(31)   :   error   C2059:   syntax   error   :   ')'  
  G:\My_Workspaces\map.cpp(32)   :   error   C2065:   'nCmdShow'   :   undeclared   identifier  
  G:\My_Workspaces\map.cpp(33)   :   error   C2065:   'UpateWindow'   :   undeclared   identifier  
  G:\My_Workspaces\map.cpp(37)   :   error   C2065:   'DispatchMessaga'   :   undeclared   identifier  
  G:\My_Workspaces\map.cpp(44)   :   error   C2556:   'long   __stdcall   WndProc(struct   HWND__   *,unsigned   int,unsigned   int,long)'   :   overloaded   function   differs   only   by   return   type   from   'int   __stdcall   WndProc(struct   HWND__   *,unsigned   int,unsigned   int,long)'  
                  G:\My_Workspaces\map.cpp(6)   :   see   declaration   of   'WndProc'  
  G:\My_Workspaces\map.cpp(44)   :   error   C2371:   'WndProc'   :   redefinition;   different   basic   types  
                  G:\My_Workspaces\map.cpp(6)   :   see   declaration   of   'WndProc'  
  G:\My_Workspaces\map.cpp(63)   :   error   C2065:   'SetViewPortOrgEx'   :   undeclared   identifier  
  Error   executing   cl.exe. 问题点数:0、回复次数:5Top

1 楼jonnylin()回复于 2005-04-02 23:58:21 得分 0

这是一个设置映射和使用映射模式的程序,通过点击鼠标左/右键来改变映射模式Top

2 楼horisly(SUN YAT-SEN UNIVERSITY (逸仙先生))回复于 2005-04-03 04:06:19 得分 0

G:\My_Workspaces\map.cpp(6)   :   error   C2143:   syntax   error   :   missing   ';'   before   '__stdcall'  
   
  ==>>LERSULT   CALLBACK   WndProc(HWND,UINT,WPARAM,LPARAM);     改为:  
          LRESULT   CALLBACK   WndProc(HWND,UINT,WPARAM,LPARAM);      
  LERSULT     ==>   LRESULT  
  ***************  
   
  G:\My_Workspaces\map.cpp(19)   :   error   C2065:   'hInstance'   :   undeclared   identifier  
   
  ==>>int   WINAPI   WinMain(HINSTANCE   hIstance,HINSTANCE   hPrevInst,LPSTR     改为:  
          int   WINAPI   WinMain(HINSTANCE   hInstance,HINSTANCE   hPrevInst,LPSTR    
  hIstance     ==>>     hInstance  
   
  **************  
   
  G:\My_Workspaces\map.cpp(33)   :   error   C2065:   'UpateWindow'   :   undeclared   identifier  
  ==>>   UpateWindow(hwnd);       改为:   UpdateWindow(hwnd)  
  Top

3 楼horisly(SUN YAT-SEN UNIVERSITY (逸仙先生))回复于 2005-04-03 04:07:38 得分 0

G:\My_Workspaces\map.cpp(37)   :   error   C2065:   'DispatchMessaga'   :   undeclared   identifier  
   
  ==>>DispatchMessaga(&Msg);     改为:   DispatchMessage(&Msg);Top

4 楼jonnylin()回复于 2005-04-03 13:21:11 得分 0

谢谢  
  现在好多了  
  只有3个错误了Top

5 楼jonnylin()回复于 2005-04-03 13:35:05 得分 0

hwnd=CreateWindow(lpszClassName,lpszTitle,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,  
                                              CW_USEDEFAULT,   CW_USEDEFAULT,NULL,NULL,hInstance,NULL);  
   
  error   C2059:   syntax   error   :   ')'  
   
  这是什么意思??  
  Top

相关问题

  • SQL错误太多了会发生死锁吗?
  • 这个错误算多大
  • 多步 OLE DB 操作产生错误,这是什么错误?
  • 多步OLE DB操作产生错误,错误号-2147217887
  • 项目其中文件太多造成打开时PB出现错误!急!!!!!
  • Window98环境下,编译.java文件,错误信息太多,超过ms-dos窗口一屏,如何看到所有的错误信息.谢谢
  • 怎么会有那么多错误?
  • VB6.0 Win32API.txt中究竟有多少错误?
  • 这个错误怎么改阿?多谢!
  • 多步 OLE DB 操作产生错误??

关键词

  • null
  • wndclass
  • lpszclassname
  • hwnd
  • usedefault
  • hinstance
  • wndproc
  • wparam
  • msg
  • cw

得分解答快速导航

  • 帖主:jonnylin

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

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