zoukankan      html  css  js  c++  java
  • win32- 窗口模板

    主要用于日常的win32窗口的测试

    #include <Windows.h>
    #include <stdio.h>
    #include <iostream>
    
    using namespace std;
    
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
        if (message == WM_DESTROY) {
    
            PostQuitMessage(0);
        }
        return DefWindowProc(hwnd, message, wParam, lParam);
    };
    
    HINSTANCE hinst;
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevinstance, PSTR szCmdLine, int iCmdShow) {
        HWND hwnd;
    
        hinst = GetModuleHandle(NULL);
        // create a window class:
        WNDCLASS wc = {};
        wc.lpfnWndProc = WndProc;
        wc.hInstance = hinst;
        wc.lpszClassName = L"win32";
    
        // register class with operating system:
        RegisterClass(&wc);
    
        // create and show window:
        hwnd = CreateWindow(L"win32", L"My program", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, 0, 0, 1000, 800, NULL, NULL, hinst, NULL);
    
        if (hwnd == NULL) {
            return 0;
        }
    
        ShowWindow(hwnd, SW_SHOW);
    
    
        MSG msg = {};
    
        while (GetMessage(&msg, NULL, 0, 0)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    
    }
  • 相关阅读:
    day09
    day8
    day 7
    day 6
    PYTHON 学习
    day 5 作业
    day04作业
    Day03作业及默写
    python 2020 day4
    (copy)python操作excel
  • 原文地址:https://www.cnblogs.com/strive-sun/p/12963955.html
Copyright © 2011-2022 走看看