对于LZ,请加Q吧:1715257750

解决方案 »

  1.   

    仅供参考:
    #pragma comment(lib,"user32")
    #pragma comment(lib,"gdi32")
    #include <stdlib.h>
    #include <conio.h>
    #include <windows.h>
    HWND WINAPI GetConsoleWindow();
    void HideTheCursor() {
        CONSOLE_CURSOR_INFO cciCursor;
        HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
        if (GetConsoleCursorInfo(hStdOut, &cciCursor)) {
            cciCursor.bVisible = FALSE;
            SetConsoleCursorInfo(hStdOut, &cciCursor);
        }
    }
    void ShowTheCursor() {
        CONSOLE_CURSOR_INFO cciCursor;
        HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
        if (GetConsoleCursorInfo(hStdOut, &cciCursor)) {
            cciCursor.bVisible = TRUE;
            SetConsoleCursorInfo(hStdOut, &cciCursor);
        }
    }
    int main() {
        HWND  hwnd;
        HDC   hdc;
        HFONT hfont;
        HBITMAP hbm;
        HDC hdcBits;
        BITMAP bm;    system("color F0");
        system("cls");
        HideTheCursor();
        hwnd  = GetConsoleWindow();
        hdc   = GetDC(hwnd);
        hfont = CreateFont(48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "华文楷体");
        SelectObject(hdc,hfont);
        TextOut(hdc,10,10,"这是泡泡",8);
        DeleteObject(hfont);
        hbm=LoadImage(0,"C:\\Windows\\Soap Bubbles.bmp",IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
        if (hbm) {
            hdcBits = CreateCompatibleDC(hdc);
            GetObject (hbm, sizeof(BITMAP), &bm);
            SelectObject(hdcBits,hbm);
            BitBlt(hdc,200,10,bm.bmWidth, bm.bmHeight,hdcBits,0,0,SRCCOPY);
            DeleteDC(hdcBits);
            DeleteObject(hbm);
        }
        ReleaseDC(hwnd,hdc);
        getch();
        system("color 07");
        system("cls");
        ShowTheCursor();
        return 0;
    }