Hey there,
I'm experimenting with GetCursorPos instead of "static_cast"ing the LOWORD and HIWORD params. This is because I want to work with positions relative to teh screen.
Myt question is this: Does the POINT object get updated when the mouse is outside of the edge of my program? If not, how do I constantly update the cursor position regardless of whether it's inside the edges of my program?
Thanks guys/gals.
-Jajjo
6 4651
Also,
I found this on MSDN
Remarks
The cursor position is always specified in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.
Is that answering my question? I 'm sorta new to all this and can't decipher that jargon :(
Ta
Jajjo
I believe that quote from MSDN tells you that the coordinates that are returned always are absolute coordinates (pixels counted from the top-left corner of your screen), and not relative to the position and size of the window which contains the cursor.
You have to call GetCursorPos every time you want the current position of the cursor, and it works when your cursor is outside of your program's window too.
Here's an extra hint to help you out with future questions: you can easily test these kind of questions yourself by trying it, and outputting the results. It can save you a lot of time because you don't have wait for a response from someone else.
Cool, thanks man :)
I'll strive to test stuff myself in the future.
It's been a very long time but are they still using WinProc? I seem to remember putting in a handler for the WM_MOUSEMOVE message. Every time the mouse moves that handler gets called.
@YarrOfDoom
I believe that the pixels are counted from the primary monitor. This means that if you are working on multiple monitors you could receive negative coordinates as the primary monitor is 0,0.
You're probably right about that, I'll try it out as soon as I've connected my KVM-switch here. edit: apparently my KVM switch doesn't work with a DVI-VGA converter, so I can't test.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: nasirmajor |
last post by:
dear alls,
i have a simple (not for me) quetion for c# or vb.net programmers.
i want a user to give any number and a programme prints a fibonacci
series for that number.thanks
|
by: ntm |
last post by:
Hi all you good m8
I try to make my first small program in vb, but im not very succesfull :D
(Im using Visual Studio 2005)
Form my own program i will like to set focus on an other running...
|
by: Rajesh Soni |
last post by:
Hi!
I'm getting a PInvoke error while trying to execute the following code...
declaration:
Structure POINTAPI
Dim x As IntPtr
|
by: Damjan Malis |
last post by:
Hi guys...
could anyone please help me with my problem getting mouse cursor position while desktop being locked (WIN + L).
MSDN says:
"The input desktop must be the current desktop when you...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |