| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 757 人关注过本帖
标题:请教高手,我是初学者,问题出在哪,谢谢啦!
取消只看楼主 加入收藏
radio983
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-11
收藏
 问题点数:0 回复次数:0 
请教高手,我是初学者,问题出在哪,谢谢啦!
# include <windows.h>
# include <stdio.h>

LRESULT CALLBACK WinSunProc(
    HWND hwnd,
    UINT uMag,
    WPARAM wParam,
    LPARAM lParam
)


int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
 )
{
    WNDCLASS wndcls;
    wndcls.cbClsExtra=0;
    wndcls.cbWndExtra=0;
    wndcls.hbrBackgroud=(HBRUSH)GetStockObject(BLACK_BRUSH);
    wndcls.hCursor=LoadCursor(NULL,IDC_CROSS);
    wndcls.hIcon=LoadIcon(NULL,IDI_ERROR);
    wndcls.hInstance=hInstance;
    wndcls.lpfnWndProc=WinSunProc;
    wndcls.lpszClassName="radio983";
    wndcls.lpszMenuName=NULL;
    wndcls.style=CS_HREDRAW | CS_VREDRAW;
    RegristerCLASS(&wndcls);

    HWND Hwnd;
    Hwnd=CreateWindow("radio983","抄袭编程",WS_OVERLAPPEDWINDOW,
        0,0,800,600,NULL,NULL,hInstance,NULL);
    ShowWindow(Hwnd,SW_SHOWNORMAL);
    UpdateWindow(Hwnd);

    MSG msg;
    while(GetMessage(&msg,NULL,0,0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return 0;
}

LRESULT CALLBACK WinSunProc(
    HWND hwnd,
    UINT uMag,
    WPARAM wParam,
    LPARAM lParam
)
{
    switch(uMag)
    {
    case WM_CHAR:
        char szChar[20];
        sprintf(szChar,"char is %d,wParam);
        MessageBox(hwnd,szChar,"radio983",0);
        break;
    case WM_LBUTTONDOWN:
        MessageBox(hwnd,"mouse clicked","radio983",0);
        HDC=hdc;
        TextOut(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 WN_CLOSE:
        if(IDYES==MessageBox(hwnd,"是否真得结束?","radio983",MB_YESNO))
        {
            DestroyWindow(hwnd);
        }
        break;
    case WN_DESTORY:
        PostQuitMessage(0);
        break;
    default:
        return DfeWindowProc(hwnd,uMag,wParam,lParam);
    }
    return 0;
}

————————————————————————————————————————————
--------------------Configuration: winmain - Win32 Debug--------------------
Compiling...
winmain.cpp
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(12) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(12) : error C2143: syntax error : missing ';' before '__stdcall'
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(22) : error C2039: 'hbrBackgroud' : is not a member of 'tagWNDCLASSA'
        d:\vc98\include\winuser.h(1184) : see declaration of 'tagWNDCLASSA'
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(30) : error C2065: 'RegristerCLASS' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(58) : error C2001: newline in constant
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(59) : error C2146: syntax error : missing ')' before identifier 'MessageBoxA'
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(63) : error C2513: 'struct HDC__ *' : no variable declared before '='
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(63) : error C2065: 'hdc' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(65) : error C2065: 'ReleaseDc' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(68) : error C2513: 'struct HDC__ *' : no variable declared before '='
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(68) : error C2065: 'hDC' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(70) : error C2065: 'hDc' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(70) : error C2440: '=' : cannot convert from 'struct HDC__ *' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(74) : error C2065: 'WN_CLOSE' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(74) : error C2051: case expression not constant
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(80) : error C2065: 'WN_DESTORY' : undeclared identifier
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(80) : error C2051: case expression not constant
D:\Program Files\MSDev98\MyProjects\lesson1\winmain.cpp(84) : error C2065: 'DfeWindowProc' : undeclared identifier
执行 cl.exe 时出错.

winmain.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: include 
2008-06-11 16:05
快速回复:请教高手,我是初学者,问题出在哪,谢谢啦!
数据加载中...
 
   



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

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