2024-04-25から1日間の記事一覧

ウィンドウで操作中、main関数のwhile文で処理

#include <windows.h>#include <iostream> // グローバル変数HWND g_hWnd;bool g_running = true; LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } } return DefW</iostream></windows.h>…

10行分スクロール

#include <iostream>#include <windows.h>#include <conio.h> const int WINDOW_HEIGHT = 10;const int TOTAL_LINES = 20; void setConsoleWindowSize(int width, int height) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SMALL_RECT rect = { 0, 0, static_cast<SHORT>(width - 1), st</short></conio.h></windows.h></iostream>…