惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - 强悍的抽屉

基于 Dapper 的一个 DbUtils WebAPI 操作返回 c#版 mqtt 3.1.1 client 实现 mqtt 协议之 PINGREQ, PINGRESP httpWebRequest 文件下载 一个 go 文件服务器 ssdb MongoDB 刷新几次就报错 C# Win32API - 强悍的抽屉 - 博客园 回车跳转控件焦点 让程序只启动一次 -- Mutex C# 排序 WINDEF.h 变量类型 SqlHelper 数据库操作类2 SqlHelper 数据库操作类 JavaScript 字符串处理函数 - 强悍的抽屉 - 博客园 JavaScript 字符串函数扩充 - 强悍的抽屉 - 博客园 C# 字符串处理一些方法 希望找人一起写个 Ajax 的封装 几种流行的JS框架的选择
第一个 Windows 应用程序
强悍的抽屉 · 2009-02-16 · via 博客园 - 强悍的抽屉

#include <windows.h>//窗口过程声明
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdline, int nCmdShow)
{
    
const char* szWindowName = "第一个 Windows 应用程序";    //窗口标题
    const char* szClassName = "WindowClass";                    //窗口类名//创建一个 WNDCLASSEX 结构体变量, 为其设置成员的值
    WNDCLASSEX wndclass;
    wndclass.cbSize        
= sizeof(WNDCLASSEX);                    //结构大小
    wndclass.style         = CS_HREDRAW | CS_VREDRAW;               //水平重画,竖直重画
    wndclass.lpfnWndProc   = (WNDPROC)WndProc;                      //窗口过程
    wndclass.cbClsExtra    = 0;                                     //没有额外的类内存
    wndclass.cbWndExtra    = 0;                                     //没有额外的窗口内存
    wndclass.hInstance     = hInstance;                             //实例句柄
    wndclass.hIcon         = LoadIcon(NULL, IDI_APPLICATION);       //程序图标
    wndclass.hCursor       = LoadCursor(NULL, IDC_CROSS);           //鼠标样式
    wndclass.hbrBackground = (HBRUSH)::GetStockObject(WHITE_BRUSH); //背景白色
    wndclass.lpszMenuName  = NULL;                                    //没有菜单名
    wndclass.lpszClassName = szClassName;                           //窗口类名
    wndclass.hIconSm       = NULL;                                  //没有类的小图标//注册 WNDCLASSEX 结构体
    ::RegisterClassEx(&wndclass);//创建主窗口
    HWND hWnd = ::CreateWindowEx(
        
0,                   //dwExstyle, 扩展样式
        szClassName,         //lpClassName, 类名
        szWindowName,         //lpWindowName, 标题
        WS_OVERLAPPEDWINDOW, //dwStyle, 窗口风格
        CW_USEDEFAULT,       //X, 初始 X 坐标
        CW_USEDEFAULT,       //Y, 初始 Y 坐标  
        CW_USEDEFAULT,       //nWidth, 宽度
        CW_USEDEFAULT,       //nHeight, 高度
        NULL,                //hWndParent, 父窗口句柄
        NULL,                //hMenu, 菜单句柄
        hInstance,           //hInstance, 程序实例句柄
        NULL);               //lpparam, 用户数据

    
if(hWnd == NULL)
    {
        ::MessageBox(NULL, 
"创建窗口出错!""error", MB_OK);
        
return FALSE;
    }
//显示窗口
    ::ShowWindow(hWnd, nCmdShow);//刷新窗口
    ::UpdateWindow(hWnd);//消息循环
    MSG msg;
    
while(::GetMessage(&msg, NULL, 00))
    {
        ::TranslateMessage(
&msg);
        ::DispatchMessage(
&msg);
    }
return msg.wParam;
}
//窗口过程函数
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    
const char* szHello = "Hello World";switch(message)
    {
    
//重绘窗口
    case WM_PAINT:
        HDC hdc;
        PAINTSTRUCT ps;
        hdc 
= ::BeginPaint(hWnd, &ps);
        ::TextOut(hdc, 
1010, szHello, strlen(szHello));
        ::EndPaint(hWnd, 
&ps);
        
break;
    
//销毁窗口
    case WM_DESTROY:
        ::PostQuitMessage(
0);
        
break;
    }
//交给系统做默认处理
    return ::DefWindowProc(hWnd, message, wParam, lParam);
}