It's always beneficial to try it yourself rather than continuously asking.![]()
To see the difference run this quick sample:
But to answer your question directly - VB's default scalemode is set to Twips and APIs return Pixels so you need to convert unless you set ScaleMode to Pixels as well.Code:Option Explicit Private Type POINTAPI X As Long Y As Long End Type Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Sub Form_Load() Timer1.Interval = 100 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Dim pt As POINTAPI GetCursorPos pt Label1.Caption = "VB6 default: " & pt.X * Screen.TwipsPerPixelX Label2.Caption = "API Default: " & pt.X End Sub




Reply With Quote