标题:窗口问题(回答了给100分)
取消只看楼主
XIAO荣
Rank: 2
等 级:论坛游民
帖 子:87
专家分:20
注 册:2009-2-26
结帖率:100%
已结贴  问题点数:100 回复次数:0 
窗口问题(回答了给100分)
程序我是照书编的。。。运行时有17个错误,请帮忙解决下。

#include<Windows.h>
long FAR PASCAL WndProc(HWND,WORD,WORD,LONG);
int PASCAL WinMain(HANDLE hInstance,HANDLE hPrevInstance,LPSTR lpszCmdParam,int nComShow)
{
    HWND hwnd;
    MSG msg;
    if(!hPrevInstance)
    {
        wc.style=NULL;
        wc.lpfnWndProc=WndProc;
        wc.cbClsExtra=0;
        wc.cbWndExtra=0;
        wc.hInstance=hInstance;
        wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
        wc.hCursor=LoadCursor(NULL,IDC_ARROW);
        wc.hbrBackgroud=GetStockObject(WHITE_BRUSH);
        wc.lpszMenuName=NULL;
        wc.lpszClassName="Class_W1";
        RegisterClass(&wc);
    }
    hwnd=GreateWindow(
        "Class_W1,
        "Hello,World-Windows style",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL
        );
    ShowWindow(hwnd,nComdShow);
    UpdateWindow(hwnd);
    while(GetMessage(&msg,NULL,NULL,NULL))
        DispatchMessage(&msg);
    return msg,wParam;
}
long FAR PASCAL WndProc(HWND hwnd,WORD message,WORD wParam,LONG lParam)
{
    switch(message)
    {
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return(DefWindowProc(hwnd,message,wParam,lParam));
        return NULL;
    }    
}
E:\C++程序\基础\窗口.cpp(4) : error C2731: 'WinMain' : function cannot be overloaded
        E:\C++程序\基础\窗口.cpp(3) : see declaration of 'WinMain'
E:\C++程序\基础\窗口.cpp(9) : error C2065: 'wc' : undeclared identifier
E:\C++程序\基础\窗口.cpp(9) : error C2228: left of '.style' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(10) : error C2228: left of '.lpfnWndProc' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(11) : error C2228: left of '.cbClsExtra' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(12) : error C2228: left of '.cbWndExtra' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(13) : error C2228: left of '.hInstance' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(14) : error C2228: left of '.hIcon' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(15) : error C2228: left of '.hCursor' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(16) : error C2228: left of '.hbrBackgroud' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(17) : error C2228: left of '.lpszMenuName' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(18) : error C2228: left of '.lpszClassName' must have class/struct/union type
E:\C++程序\基础\窗口.cpp(21) : error C2065: 'GreateWindow' : undeclared identifier
E:\C++程序\基础\窗口.cpp(22) : error C2001: newline in constant
E:\C++程序\基础\窗口.cpp(33) : error C2440: '=' : cannot convert from 'int' to 'struct HWND__ *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
E:\C++程序\基础\窗口.cpp(34) : error C2065: 'nComdShow' : undeclared identifier
E:\C++程序\基础\窗口.cpp(38) : error C2065: 'wParam' : undeclared identifier
Error executing cl.exe.

[ 本帖最后由 XIAO荣 于 2009-8-22 10:50 编辑 ]
搜索更多相关主题的帖子: 窗口 
2009-08-22 10:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-283417-1-1.html




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

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