获取桌面坐标



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        #region
     
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetCursorPos(out POINT pt);
        [StructLayout(LayoutKind.Sequential)]
        public struct POINT
        {
            public int X;
            public int Y;
            public POINT(int x, int y)
            {
                this.X = x;
                this.Y = y;
            }
        }
        #endregion

        private void timer1_Tick(object sender, EventArgs e)
        {
            POINT pt = new POINT();
            GetCursorPos(out pt);
            textBox1.Text = string.Format("{0},{1}", pt.X,pt.Y);
        }
    }
}

附件列表

GetCursorPos的更多相关文章

  1. GetCursorPos/WindowFromPoint/SendMessage

    GetCursorPos/WindowFromPoint/SendMessage (用API函数向Edit框发送字符) GetCursorPos(mPoint); DTWND:=WindowFromP ...

  2. C#中使用GetCursorPos获取屏幕坐标

    [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; public POINT ...

  3. WPF 定时器DispatcherTimer+GetCursorPos 的使用,动态查看屏幕上任一点坐标

    原文:WPF 定时器DispatcherTimer+GetCursorPos 的使用,动态查看屏幕上任一点坐标 );                           dTimer.Start(); ...

  4. Delphi - 通过WinAPI GetCursorPos实现鼠标位置的实时显示

    通过WinAPI GetCursorPos实现鼠标位置的实时显示 有时候我们需要将鼠标的位置实时抓取出来,可以通过如下方式实现. 添加一个Timer控件,执行间隔改为100ms,双击控件输入如下代码: ...

  5. Delphi 鼠标控制函数GetCursorPos、SetCursorPos

    GetCursorPos函数  获取鼠标的位置 var P: TPoint; begin GetCursorPos(P); //获取鼠标位置 end; SetCursorPos函数 设置鼠标的位置 v ...

  6. [C#] 软硬结合第二篇——酷我音乐盒的逆天玩法

    1.灵感来源: LZ是纯宅男,一天从早上8:00起一直要呆在电脑旁到晚上12:00左右吧~平时也没人来闲聊几句,刷空间暑假也没啥动态,听音乐吧...~有些确实不好听,于是就不得不打断手头的工作去点击下 ...

  7. C++ 最小化到托盘

    #define WM_SHOWTASK (WM_USER + 1) void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID &a ...

  8. Windows API 函数列表 附帮助手册

    所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...

  9. 局域网象棋游戏(C++实现,使用Socket,界面使用Win32,CodeBlocks+GCC编译)

    目录 成果 运行效果图 过程 1. 首先的问题是下棋的两端应该是什么样的? 2. 接下来的问题是怎么表示,怎么存储? 3. 然后应该怎么通信呢? 代码 main.cpp chinese_chess.h ...

随机推荐

  1. ZSTU OJ 4273 玩具

    枚举,二分,$RMQ$. 肯定是将连续一段中最大值免去花费,枚举起点之后,二分终点即可.可以证明单调性. #include<map> #include<set> #includ ...

  2. CodeForces 723F st-Spanning Tree

    $dfs$,构造. 类似于$k$度限制生成树的想法,可以将$s$和$t$先从图中删去,将剩下的部分求连通块,每个连通块内部很容易构造生成树,每个连通块缩成一个点来处理. 连通块分三种: $1$.只与$ ...

  3. Spring Security静态资源访问

    在使用Spring Security时要求所有请求都需要授权访问,此时会定义过滤规则如下 protected void configure(HttpSecurity http) throws Exce ...

  4. 关于使用jqmobi前端框架在phonegap平台上开发时的日期时间选择控件

    jqmobi(appframework)作为Intel的一款html5移动前端框架,以其自身轻量级和容易上手获得了很多移动HTML5开发者的喜爱,相对于jquerymobile,它可以说将jQuery ...

  5. Binary Tree Longest Consecutive Sequence -- LeetCode

    Given a binary tree, find the length of the longest consecutive sequence path. The path refers to an ...

  6. Codeforces 980 E. The Number Games

    \(>Codeforces \space 980 E. The Number Games<\) 题目大意 : 有一棵点数为 \(n\) 的数,第 \(i\) 个点的点权是 \(2^i\) ...

  7. 【数论】【快速幂】【扩展欧几里得】【BSGS算法】bzoj2242 [SDOI2011]计算器

    说是BSGS……但是跟前面那题的扩展BSGS其实是一样的……因为模数虽然是质数,但是其可能可以整除a!!所以这两者其实是一样的…… 第一二种操作不赘述. #include<cstdio> ...

  8. 20162303实验三 敏捷开发与XP实践-1

    北京电子科技学院(BESTI) 实 验 报 告 课程:程序设计与数据结构 班级: 1623 姓名: 石亚鑫 学号:20162303 成绩: 2分 指导教师:娄嘉鹏 王志强 实验日期:5月12日 实验密 ...

  9. iOS笔记 基于MKNetworkKit的断点续传

    http://iiiyu.com/2012/07/07/learning-ios-notes-eight/

  10. PHP 5.3.13 memcache win 64 配置和安装

    --环境: windows 2008 R2 64位 wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64 --目标: 实现 php 用memcach ...