标题:刚学习C++的菜鸟,请各位大侠帮帮我看一下源程序哪儿出错了
只看楼主
冒水
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-7-8
结帖率:0
已结贴  问题点数:20 回复次数:1 
刚学习C++的菜鸟,请各位大侠帮帮我看一下源程序哪儿出错了
#include<windows.h>
LRESULT CALLBACK WindowProc(HWND hwnd,
    UINT Umsgld,
    WPARAM wParam,
    LPARAM lParam);
int WINAPI WinMain(HINSTANCE hinstance,
    HINSTANCE hPrevInstance,
    LPSTR pszCmdlind,
    int nCmdShow)
{
    static char szAppName[] = "无标题3";
    HWND hwnd; MSG msg;
    WNDCLASS wndclass;
    wndclass.style = 0;
    wndclass.lpfnWndProc = WindowProc;
    wndclass.cbClsExtra = 0;
    wndclass.cbWndExtra = 0;
    wndclass.hInstance = hinstance;
    wndclass.hCursor=LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground =(HBRUSH)GetStockObject(WHITE_BRUSH);
    wndclass.lpszMenuName =(LPCSTR) LoadMenu(hinstance, "MainMenu");
    wndclass.lpszClassName = szAppName;
    if (RegisterClass( &wndclass ) == 0)
    {
        return 0;
    }
    hwnd = CreateWindow(
        szAppName,
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hinstance,
        NULL);
    if (hwnd == 0)
    {
        return 0;
    }
    ShowWindow(hwnd, nCmdShow);
        UpdateWindow(hwnd);
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}
LRESULT CALLBACK WindowProc(HWND hwnd,
    UINT uMsgld,
    WPARAM wParam,
    LPARAM lParam)
{static char*pszHello = "HELLO,HOW APE YOU?";

    switch (uMsgld)
    {
    case WM_PAINT:
            HDC hDC;
            PAINTSTRUCT paintStruct;
            hDC = BeginPaint(hwnd, &paintStruct);
            TextOut(hDC, 0, 0, pszHello, lstrlen(pszHello));
            EndPaint(hwnd, &paintStruct);
            return 0;
    case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
               default:
                return DefWindowProc(hwnd, uMsgld, wParam, lParam);
    }

}
搜索更多相关主题的帖子: include 源程序 
2016-07-15 19:01
我是XXX
Rank: 2
等 级:论坛游民
威 望:1
帖 子:11
专家分:40
注 册:2016-7-16
得分:20 
可以运行啊!你这个软件的目的是什么?
2016-07-18 15:49



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




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

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