0
Thanks

A few words of thanks would be greatly appreciated.

VB6 - Locating the absolute position of the mouse.




This feature allows you to know exact the position of the mouse from the screen and irrelevant from the sheet or control it contains.

The Module

Declaring the function


Public Type POINTAPI 
        x As Long 
        y As Long 
End Type 
Public m_CursorPos As POINTAPI 

Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Creating the function


Sub GetCursor() 
Dim LonCStat As Long 
    LonCStat = GetCursorPos&(m_CursorPos) 
    'to use this result, the data must be converted into Pixel 
. 
    m_CursorPos.x = m_CursorPos.x * Screen.TwipsPixelX 
    m_CursorPos.y = m_CursorPos.y * Screen.TwipsPixelY 
End Sub
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by jak58.

This document, titled "VB6 - Locating the absolute position of the mouse.," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments