• windows sdk编程禁止窗体最大化最小化


    #include <windows.h>
    
    
    /*消息处理函数声明*/
    HRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
    
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
        
         HWND hwnd;
         MSG message;
        WNDCLASS wndClass;
        
        char szClassName[] = "MainWindonClass";//窗体类名
        
        DWORD dwStyle = WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_MINIMIZEBOX; //设置窗体样式 
        
        /*窗口类设置*/
        wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
        wndClass.lpfnWndProc=WindowProc;
        wndClass.cbClsExtra=0;
        wndClass.cbWndExtra=0;
        wndClass.hInstance=hInstance;
        wndClass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
        wndClass.hCursor=LoadCursor (NULL, IDC_ARROW);
        wndClass.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
        wndClass.lpszMenuName=NULL;
        wndClass.lpszClassName=szClassName;
        
        /*窗口类注册*/
        if( RegisterClass(&wndClass) == 0 )
            return 0;//表示注册失败 
        
        /*创建窗体*/
        hwnd = CreateWindow(szClassName,
                            "禁止最大化和最小化",
                            dwStyle,//设置窗体样式 
                            300,
                            300,
                            300,
                            300,
                            NULL,
                            NULL,
                            hInstance,
                            NULL
                            );
         if(hwnd == 0)
         {
             MessageBox(NULL,"窗体创建失败!","失败",MB_OK);
             return 0;
        }
             
        /* 显示窗体 */
        ShowWindow(hwnd,nCmdShow);
        
        while (GetMessage (&message, NULL, 0, 0))
        {
            TranslateMessage(&message);//翻译 
            DispatchMessage(&message);//发送消息 
        } 
        
        return message.wParam;
    }
    
    /*消息处理*/
    LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message)                  
        {
            case WM_DESTROY:
                PostQuitMessage (0);       
                break;
            default:
                return DefWindowProc (hwnd, message, wParam, lParam);
        }
    
        return 0;
    } 

     

  • 相关阅读:
    mysql导出csv文件
    httpclient设置proxy与proxyselector
    91删除数据
    使用RestTemplate post方式提交表单数据
    bootstrap获取总条目数
    获取字符串已utf-8表示的字节数
    mongo批量更新
    重庆大学计算机917考研分析(定期更新考研信息)
    卷积
    LaTeX中自定义enumerate的编号格式
  • 原文地址:https://www.cnblogs.com/dzqdzq/p/3237973.html
Copyright © 2020-2023  润新知