{"id":78,"date":"2025-10-30T00:03:25","date_gmt":"2025-10-29T16:03:25","guid":{"rendered":"https:\/\/cilici.cn\/?p=78"},"modified":"2025-10-30T00:03:26","modified_gmt":"2025-10-29T16:03:26","slug":"c%e8%af%ad%e8%a8%80%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/cilici.cn\/index.php\/2025\/10\/30\/c%e8%af%ad%e8%a8%80%e4%bb%a3%e7%a0%81\/","title":{"rendered":"C\u8bed\u8a00\u4ee3\u7801"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;windows.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;time.h&gt;\n\n\/\/ \u4fee\u6539\u4e3a\u9f13\u52b1\u81ea\u5df1\u3001\u7231\u81ea\u5df1\u7684\u79ef\u6781\u8bdd\u8bed\nconst char* tips&#91;] = {\n    \"\u597d\u597d\u7231\u81ea\u5df1\", \"\u591a\u559d\u6c34\u54e6~\", \"\u4fdd\u6301\u5fae\u7b11\u5440\", \"\u6bcf\u5929\u90fd\u8981\u5143\u6c14\u6ee1\u6ee1\",\n    \"\u8bb0\u5f97\u5403\u6c34\u679c\", \"\u4fdd\u6301\u597d\u5fc3\u60c5\", \"\u68a6\u60f3\u6210\u771f\", \"\u987a\u987a\u5229\u5229\", \n    \"\u65e9\u70b9\u4f11\u606f\", \"\u613f\u6240\u6709\u70e6\u607c\u90fd\u6d88\u5931\", \"\u522b\u71ac\u591c\", \"\u4eca\u5929\u8fc7\u5f97\u5f00\u5fc3\u561b\", \n    \"\u5929\u51b7\u4e86\uff0c\u591a\u7a7f\u8863\u670d\", \"\u4f60\u662f\u6700\u68d2\u7684\", \"\u76f8\u4fe1\u81ea\u5df1\", \"\u4e00\u5207\u90fd\u4f1a\u597d\u7684\",\n    \"\u6df1\u547c\u5438\uff0c\u653e\u677e\", \"\u4eca\u5929\u4e5f\u8981\u52a0\u6cb9\", \"\u4f60\u5f88\u7279\u522b\", \"\u63a5\u7eb3\u4e0d\u5b8c\u7f8e\u7684\u81ea\u5df1\",\n    \"\u7ed9\u81ea\u5df1\u4e00\u4e2a\u62e5\u62b1\", \"\u4f60\u5df2\u7ecf\u505a\u5f97\u5f88\u597d\u4e86\", \"\u6162\u6162\u6765\uff0c\u4e0d\u7740\u6025\",\n    \"\u575a\u6301\u5c31\u662f\u80dc\u5229\", \"\u611f\u6069\u4eca\u5929\", \"\u6d3b\u5728\u5f53\u4e0b\", \"\u672a\u6765\u53ef\u671f\",\n    \"\u5fc3\u82e5\u5411\u9633\uff0c\u65e0\u754f\u60b2\u4f24\", \"\u6bcf\u4e00\u5929\u90fd\u662f\u65b0\u7684\u5f00\u59cb\", \"\u505a\u81ea\u5df1\u7684\u592a\u9633\"\n};\n\nint tipCount = 30;\n\n\/\/ \u7a97\u53e3\u8fc7\u7a0b\u51fd\u6570\nLRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n    switch (uMsg) {\n        case WM_PAINT: {\n            PAINTSTRUCT ps;\n            HDC hdc = BeginPaint(hwnd, &amp;ps);\n            \n            \/\/ \u79ef\u6781\u5411\u4e0a\u7684\u989c\u8272\u65b9\u6848\n            COLORREF colors&#91;] = {\n                RGB(255, 182, 193), \/\/ \u6d45\u7c89\u8272 - \u6e29\u67d4\n                RGB(135, 206, 235), \/\/ \u5929\u84dd\u8272 - \u5b81\u9759\n                RGB(144, 238, 144), \/\/ \u6d45\u7eff\u8272 - \u751f\u673a\n                RGB(255, 255, 224), \/\/ \u6d45\u9ec4\u8272 - \u6e29\u6696\n                RGB(230, 230, 250), \/\/ \u85b0\u8863\u8349\u8272 - \u5e73\u548c\n                RGB(175, 238, 238), \/\/ \u6de1\u84dd\u8272 - \u6e05\u65b0\n                RGB(152, 251, 152), \/\/ \u6de1\u7eff\u8272 - \u5e0c\u671b\n                RGB(255, 228, 196), \/\/ \u6843\u8272 - \u6e29\u99a8\n                RGB(240, 255, 240), \/\/ \u871c\u767d\u8272 - \u7eaf\u51c0\n                RGB(255, 250, 205)  \/\/ \u67e0\u6aac\u7ef8 - \u660e\u4eae\n            };\n            \n            HBRUSH hBrush = CreateSolidBrush(colors&#91;rand() % 10]);\n            FillRect(hdc, &amp;ps.rcPaint, hBrush);\n            DeleteObject(hBrush);\n            \n            \/\/ \u8bbe\u7f6e\u6587\u5b57\n            SetTextColor(hdc, RGB(0, 0, 0));\n            SetBkMode(hdc, TRANSPARENT);\n            \n            \/\/ \u521b\u5efa\u5b57\u4f53\n            HFONT hFont = CreateFont(20, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, \n                                    GB2312_CHARSET, OUT_DEFAULT_PRECIS,\n                                    CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,\n                                    DEFAULT_PITCH | FF_SWISS, \"\u5b8b\u4f53\");\n            SelectObject(hdc, hFont);\n            \n            \/\/ \u7ed8\u5236\u6587\u5b57\n            RECT rect;\n            GetClientRect(hwnd, &amp;rect);\n            const char* tip = (const char*)GetWindowLongPtr(hwnd, GWLP_USERDATA);\n            DrawTextA(hdc, tip, -1, &amp;rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);\n            \n            EndPaint(hwnd, &amp;ps);\n            return 0;\n        }\n        \n        case WM_LBUTTONDOWN:\n            DestroyWindow(hwnd);\n            return 0;\n            \n        case WM_DESTROY:\n            PostQuitMessage(0);\n            return 0;\n    }\n    return DefWindowProc(hwnd, uMsg, wParam, lParam);\n}\n\nint main() {\n    srand((unsigned)time(NULL));\n    \n    \/\/ \u6ce8\u518c\u7a97\u53e3\u7c7b\n    WNDCLASSEX wc = {0};\n    wc.cbSize = sizeof(WNDCLASSEX);\n    wc.lpfnWndProc = WindowProc;\n    wc.hInstance = GetModuleHandle(NULL);\n    wc.lpszClassName = \"TipWindow\";\n    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);\n    RegisterClassEx(&amp;wc);\n    \n    int screenWidth = GetSystemMetrics(SM_CXSCREEN);\n    int screenHeight = GetSystemMetrics(SM_CYSCREEN);\n    \n    printf(\"\u5c4f\u5e55\u5c3a\u5bf8: %dx%d\\n\", screenWidth, screenHeight);\n    printf(\"\u5f00\u59cb\u521b\u5efa\u81ea\u6211\u5173\u7231\u63d0\u9192\u7a97\u53e3...\\n\");\n    \n    \/\/ \u7a97\u53e3\u5c3a\u5bf8\n    int windowWidth = 320, windowHeight = 120;\n    \n    \/\/ \u521b\u5efa\u7a97\u53e3\u6570\u91cf\n    int windowCount = 50;\n    \n    printf(\"\u5c06\u521b\u5efa %d \u4e2a\u81ea\u6211\u5173\u7231\u63d0\u9192\u7a97\u53e3\\n\", windowCount);\n    \n    \/\/ \u521b\u5efa\u591a\u4e2a\u7a97\u53e3\uff0c\u4f7f\u7528\u5b8c\u5168\u968f\u673a\u4f4d\u7f6e\n    for (int i = 0; i &lt; windowCount; i++) {\n        \/\/ \u5b8c\u5168\u968f\u673a\u4f4d\u7f6e\uff0c\u786e\u4fdd\u7a97\u53e3\u5728\u5c4f\u5e55\u5185\n        int x = rand() % (screenWidth - windowWidth);\n        int y = rand() % (screenHeight - windowHeight);\n        \n        const char* tip = tips&#91;rand() % tipCount];\n        \n        HWND hwnd = CreateWindowEx(\n            WS_EX_TOPMOST, \"TipWindow\", \"\u81ea\u6211\u5173\u7231\u63d0\u9192\",\n            WS_POPUP | WS_CAPTION | WS_SYSMENU,\n            x, y, windowWidth, windowHeight, NULL, NULL, GetModuleHandle(NULL), NULL\n        );\n        \n        if (hwnd) {\n            SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)tip);\n            ShowWindow(hwnd, SW_SHOW);\n            UpdateWindow(hwnd);\n        }\n        \n        \/\/ \u7a0d\u5fae\u5ef6\u8fdf\n        Sleep(10);\n    }\n    \n    printf(\"\u6240\u6709\u81ea\u6211\u5173\u7231\u63d0\u9192\u7a97\u53e3\u521b\u5efa\u5b8c\u6210\uff01\u70b9\u51fb\u4efb\u610f\u7a97\u53e3\u53ef\u5173\u95ed\\n\");\n    printf(\"\u8bb0\u5f97\u597d\u597d\u7231\u81ea\u5df1\uff01\\n\");\n    \n    \/\/ \u6d88\u606f\u5faa\u73af\n    MSG msg;\n    while (GetMessage(&amp;msg, NULL, 0, 0)) {\n        TranslateMessage(&amp;msg);\n        DispatchMessage(&amp;msg);\n    }\n    \n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":1,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":79,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/posts\/78\/revisions\/79"}],"wp:attachment":[{"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cilici.cn\/index.php\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}