码迷,mamicode.com
首页 > Windows程序 > 详细

【Win32】Windows

时间:2014-05-01 05:08:48      阅读:477      评论:0      收藏:0      [点我收藏+]

标签:des   com   http   style   blog   class   div   img   code   c   java   

mamicode.com,码迷
#include <windows.h>

LRESULT CALLBACK WindowProc(
    HWND hwnd,
    UINT uMsg,
    WPARAM wParam,
    LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

int CALLBACK WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
{
    static TCHAR lpClassName[] = TEXT("Susake");

    HWND hwnd;
    MSG msg;
    WNDCLASSEX wincl;

    wincl.cbSize = sizeof(WNDCLASSEX);
    wincl.style = NULL;
    wincl.lpfnWndProc = WindowProc;
    wincl.cbClsExtra = 0;
    wincl.cbWndExtra = 0;
    wincl.hInstance = hInstance;
    wincl.hIcon = NULL;
    wincl.hCursor = NULL;
    wincl.hbrBackground = NULL;
    wincl.lpszMenuName = NULL;
    wincl.lpszClassName = lpClassName;
    wincl.hIconSm = NULL;

    RegisterClassEx(&wincl);

    hwnd = CreateWindowEx(0,
        lpClassName,
        TEXT("Susake"),
        WS_OVERLAPPEDWINDOW,
        0, 0,
        800, 600,
        HWND_DESKTOP,
        NULL,
        hInstance,
        NULL);

    ShowWindow(hwnd, nCmdShow);

    UpdateWindow(hwnd);

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

    UnregisterClass(lpClassName, wincl.hInstance);
    return msg.wParam;
}
mamicode.com,码迷

 

【Win32】Windows,码迷,mamicode.com

【Win32】Windows

标签:des   com   http   style   blog   class   div   img   code   c   java   

原文地址:http://www.cnblogs.com/Susake/p/3702082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!