|
-
April 14th, 1999, 02:28 AM
#1
pixel under cursor?
Anyone have some code to tell what is the pixel color under the cursor?
-
April 14th, 1999, 04:27 AM
#2
Re: pixel under cursor?
Hi,
You can do the following to know what is the pixel color under the mouse cursor.
1.Get the cursor location using API GetCursorPos. Remember this is in screen coordinates. You need to convert it to client window coordinates using API ScreenToClient
2.Get a handle to the device context for this window which has the cursor contained in it. (you can use WindowFromPoint ChildWindowFromPoint for this)
3.Get a handle to a device context, and then use the API GetPixel
I think this should solve the problem.
Regards
Saurabh
-
April 14th, 1999, 04:38 AM
#3
Re: pixel under cursor?
POINT pt;
GetCursorPos( &pt );
HDC sdc = GetDC( 0 );
COLORREF color = GetPixel( sdc, pt.x, pt.y );
ReleaseDC( 0, sdc );
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|