[VB6] Knowing the absolute position of the mouse.

Last update on August 2, 2009 12:37 PM by jak58
Published by jak58

[VB6] Knowing 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
Best answers for « Knowing the absolute position of the mouse. » in :
Automatic alignment of the mouse cursor Show Automatic alignment of the mouse cursor To save time in Windows, when installing software for example, it is possible to ensure that the mouse is automatically positioned in the button selected by default. On Windows 2000 and Windows XP, you...
The mouse Show Introduction to the mouse The mouse is a pointing device used to move a cursor on the screen and allowing objects to be selected, moved and manipulated using the buttons. The consistent action of pressing (clicking) on a button in order to carry...
Changing your mouse pointer ShowChanging your mouse pointer This simple tips is designated to show you how to change your mouse pointer: Right-click on your desktop and scroll to "Personalize". In the open window, select Personalize appearance and sound....
Mouse or touch-pad acting erratically[Automatic clicking issue] ShowMouse or touch-pad acting erratically[Automatic clicking issue] Issue Solution Notes Issue An very annoying issue, when I was typing on my laptop my cursor would jump around or putting the mouse pointer over an icon will automatically...
Moving or copying a file with your right mouse button ShowMoving or copying a file with your right mouse button Command for right mouse button Create a file in the registry Set up of the file in the registry Command for right mouse button To move or copy your document and file to another...
Download Key Mouse Genie ShowKey Mouse Genie is a tool to control your mouse by the means of your keyboard. It is possible to move the mouse, send left or right clicks and double-clicks. The Ctrl-D key allows to enable or disable the mouse control. Key Mouse Genie supports...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...
Spreadsheets - Mathematical Functions ShowStandard Functions Function Description ABS() This function returns the absolute value of a number. It therefore returns the number, if it is positive, or the opposite (positive) if it is negative ODD(value) Rounds a number up to the...
Web Positionning ShowWhat is Web Positionning? "Web positioning" generally means all the techniques used to improve website visibility: referencing), which consists of introducing the website into search tools by filling out the search tools' forms positionning),...