注册 登录
编程论坛 VC++/MFC

为什么运行不了?

你爸边哭边 发布于 2018-06-04 18:22, 1825 次点击
#include <Windows.h>
#define WINDOW_WIDTH    800                           

#define WINDOW_HEIGHT    600                        

#define WINDOW_TITLE    L"chuangkou"
LRESULT CALLBACK wndproc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)
{
    WNDCLASS wandclass;
    HWND hwnd;
    MSG msg;
    wandclass.style=0;
    wandclass.lpfnWndProc=wndproc;
    wandclass.cbClsExtra=0;
    wandclass.cbWndExtra=0;
    wandclass.hInstance=hinstance;
    wandclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
    wandclass.hCursor=LoadCursor(NULL,IDC_ARROW);
    wandclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
    wandclass.lpszMenuName=NULL;
    wandclass.lpszClassName=L"ForTheDreamOfGameDevelop";
    if(!RegisterClass(&wandclass))
    {return -1;
    }
     hwnd = CreateWindow( L"ForTheDreamOfGameDevelop",WINDOW_TITLE,            WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH,

        WINDOW_HEIGHT, NULL, NULL, hinstance, NULL );
    UpdateWindow(hwnd);
    while(GetMessage(&msg,NULL,0,0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return msg.wParam;
}

LRESULT CALLBACK wndproc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{switch(message)
{case WM_DESTROY:
PostQuitMessage(0);
default:
    return DefWindowProc( hwnd,message,wParam,lParam);
}
}
0 回复
1