跳到正文

个人记录

控制台基本操作

Hjr1141451931约 1 分钟
原文
文章信息与版本

文章信息

发布
2021年12月14日
收录
2025年12月12日
更新
2026年11月11日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
HANDLE Out=GetStdHandle(STD_OUTPUT_HANDLE);
bool over=false;
void CursorControl()
{
	POINT p;
	HWND hWnd=GetForegroundWindow();
	int dex,dey;
	while(!over)
	{
		MoveWindow(hWnd,0,0,1920,1020,false);
		SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
		GetCursorPos(&p);
		dex=p.x-990;
		dey=540-p.y;
		system("cls");
		cout<<dex<<' '<<dey<<endl;
		SetCursorPos(990,540);
		Sleep(10);
	}
}
int main()
{
	srand(time(NULL));
	thread Control(CursorControl);
	Control.detach();
	while(getch()!='e')
	{
		
	}
	over=true;
	return 0;
}
原文