⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 text.cpp

📁 打开
💻 CPP
字号:
#include <iostream.h>
#include <windows.h>

void getMousePos()
{
   POINT point;
   GetCursorPos(&point);
   cout<<point.x<<"  "<<point.y<<endl;
}
 
void moveMouse()
{
	cout<<"请输入鼠标新坐标:"<<endl;
	int a,b;
	cout<<"x方向:";
	cin>>a;
	cout<<"y方向:";
	cin>>b;
    SetCursorPos(a,b);	
}

void main()
{
	cout<<"鼠标位置演示"<<endl;
         cout<<"1 获取鼠标当前位置"<<endl
	<<"2 移动鼠标"<<endl
	<<"其他键退出"<<endl;
	while(1)
	{
		int choice;
		cout<<endl<<"请输入操作:";
		cin>>choice;
		switch(choice)
		{
		    case 1:  getMousePos();break;
		    case 2:  moveMouse();break;
		    default: exit(1);break;
		}
	}
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -