Minigui学习---鼠标获取和坐标在不同区域转换

本文介绍了Minigui中如何设置鼠标捕获,并详细讲解了屏幕坐标、窗口坐标及客户区坐标的转换,包括SetCapture、ReleaseCapture函数的使用,以及ClientToScreen、ScreenToClient、WindowToScreen、ScreenToWindow四个坐标转换函数的实例演示。
摘要由CSDN通过智能技术生成

(1)设置鼠标的所在的Wnd:

函数定义(window.h文件中定义的):

MG_EXPORT HWND GUIAPI GetCapture(void); //Retrives the handle to the window (if any) that has captured the mouse.return The handle to the window that has captured the mouse, 0 for no window captures the mouse.

Only one window at a time can capture the mouse; this window receives mouse input whether or not the cursor is within its borders.

MG_EXPORT HWND GUIAPI SetCapture(HWND hWnd);//Sets the mouse capture to the specified window. param hWnd The handle to the window.return The old capture window. Once a window has captured the mouse, all mouse input is directed to that window, regardless of whether the cursor is within the borders of that window. Only one window at a time can capture the mouse.

MG_EXPORT void GUIAPI ReleaseCapture(void); //Releases the mouse capture from a window and restores normal mouse  input processing

例如:

  printf("hjhe--hwnd=%x\n",hWnd);
  printf("hjhe--getCapture=%x\n",GetCapture());
  SetCapture(hWnd);
  printf("hjhe--1 getCapture=%x\n",GetCapture());

返回值为:

hjhe--hwn

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值