| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1251 人关注过本帖
标题:求助:c++编译的一个问题
只看楼主 加入收藏
msncpu
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-3-9
收藏
 问题点数:0 回复次数:0 
求助:c++编译的一个问题
源程序:
#include <windows.h>
#include <stdio.h>

int WINAPI winmain{
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
}
{
    WNDCLASS wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbWndExtra=0;
    wndcls.hbrBackground=(HBRUSH)GetStockobject(black_brush);
    wndcls.hcursor=loadcursor(null,idc_cross);
    wndcls.hicon=loadicon(null,idi_error);
    wndcls.hinstance=hinstance;
    wndcls.lpfnwndproc=winsunproc;
    wndcls.lpszclassname="Weixin2003";
    wndcls.lpszmenuname=null;
    wndcls.style=|cs_hredraw | cs_verdraw;
    registerclass(&wndcls);

    hwnd hwnd;
    hwnd=createwindow("Weixin2003","北京维新科学技术培训中心",ws overlappedwindow,
        0,0,600,400,NULL,NULL,hInstance,NULL);

    showwindow(hwnd,sw_showhormal);
    updatewindow(hwnd);

    msg msg;
    while(getmessage(&msg,null,0,0))
    {
        translatemessage(&msg);
        dispatchmessage(&msg);
    }
    return 0;
}

LRESULT CALLBACK WInSunProc(
    HWND  hwnd,
    UINT umsg,
    wpapam wparam,
    lparam lparam
    )
{
    switch(umsg)
    {
    case wm_char:
        char szChar[20];
        sprintf(szChar,"char is %d ",wparam);
        messageBox(hwnd,szchar,"weixin",0);
        break;
    case wm_lbuttondown:
        messageBox(hwnd,"mouse clicked","weixin",0);
        HDC hdc;
        hdc=GetDC(hdc ,0,50,"计算机",strlen("计算机"));
        ReleaseDc(hwnd,hdc);
        break;
    case wm_paint:
        HDC hDC;
        PAINTSTRUCT ps;
        hDC=BeginPaint(hwnd,&ps);
        Textout(hDc,0,0,"维新培训",strlen("维新培训");
        EndPaint(hwnd,&ps);
        break;
    case WM_Destroy:
        PostQuitmessage(0);
        break;
    default:
        return defwindowproc(hwnd,umsg,wparam,lparam);
    }
    return 0;
}
编译出错信息:
--------------------Configuration: winmain - Win32 Debug--------------------
Compiling...
winmain.cpp
d:\work\study\c++\lesson1\winmain\winmain.cpp(4) : warning C4229: anachronism used : modifiers on data are ignored
d:\work\study\c++\lesson1\winmain\winmain.cpp(4) : error C2239: unexpected token '{' following declaration of 'winmain'
d:\work\study\c++\lesson1\winmain\winmain.cpp(10) : error C2447: missing function header (old-style formal list?)
d:\work\study\c++\lesson1\winmain\winmain.cpp(43) : error C2061: syntax error : identifier 'wpapam'
d:\work\study\c++\lesson1\winmain\winmain.cpp(49) : error C2065: 'wm_char' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(49) : error C2051: case expression not constant
d:\work\study\c++\lesson1\winmain\winmain.cpp(51) : error C2065: 'wparam' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(52) : error C2065: 'messageBox' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(52) : error C2065: 'szchar' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(54) : error C2065: 'wm_lbuttondown' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(54) : error C2051: case expression not constant
d:\work\study\c++\lesson1\winmain\winmain.cpp(57) : error C2660: 'GetDC' : function does not take 5 parameters
d:\work\study\c++\lesson1\winmain\winmain.cpp(58) : error C2065: 'ReleaseDc' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(60) : error C2065: 'wm_paint' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(60) : error C2051: case expression not constant
d:\work\study\c++\lesson1\winmain\winmain.cpp(64) : error C2065: 'Textout' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(64) : error C2065: 'hDc' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(64) : error C2143: syntax error : missing ')' before ';'
d:\work\study\c++\lesson1\winmain\winmain.cpp(67) : error C2065: 'WM_Destroy' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(67) : error C2051: case expression not constant
d:\work\study\c++\lesson1\winmain\winmain.cpp(68) : error C2065: 'PostQuitmessage' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(71) : error C2065: 'defwindowproc' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(71) : error C2065: 'lparam' : undeclared identifier
d:\work\study\c++\lesson1\winmain\winmain.cpp(72) : warning C4065: switch statement contains 'default' but no 'case' labels
执行 cl.exe 时出错.
winmain.obj - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: wndcls windows 编译 int HINSTANCE 
2008-03-09 12:35
快速回复:求助:c++编译的一个问题
数据加载中...
 
   



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

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