home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch13 / mousepos / mousepos.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-04-26  |  1.8 KB  |  61 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Mouse Position"
  4.    ClientHeight    =   1575
  5.    ClientLeft      =   60
  6.    ClientTop       =   330
  7.    ClientWidth     =   3630
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1575
  10.    ScaleWidth      =   3630
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.Label LabelY 
  13.       Caption         =   "Label"
  14.       Height          =   375
  15.       Left            =   2040
  16.       TabIndex        =   2
  17.       Top             =   840
  18.       Width           =   1215
  19.    End
  20.    Begin VB.Label Label2 
  21.       Caption         =   "Mouse Position"
  22.       Height          =   255
  23.       Left            =   240
  24.       TabIndex        =   1
  25.       Top             =   240
  26.       Width           =   2055
  27.    End
  28.    Begin VB.Label LabelX 
  29.       Caption         =   "Label"
  30.       Height          =   375
  31.       Left            =   240
  32.       TabIndex        =   0
  33.       Top             =   840
  34.       Width           =   1215
  35.    End
  36. Attribute VB_Name = "Form1"
  37. Attribute VB_GlobalNameSpace = False
  38. Attribute VB_Creatable = False
  39. Attribute VB_PredeclaredId = True
  40. Attribute VB_Exposed = False
  41. '  ******************************
  42. '  ******************************
  43. '  ** MASTERING VB6            **
  44. '  ** by Evangelos Petroutos   **
  45. '  ** SYBEX, 1998              **
  46. '  ******************************
  47. '  ******************************
  48. Option Explicit
  49. Private Type POINTAPI
  50.     X   As Long
  51.     Y   As Long
  52. End Type
  53. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  54. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  55. Dim MouseLoc As POINTAPI
  56. Dim retValue As Boolean
  57.     retValue = GetCursorPos(MouseLoc)
  58.     LabelX.Caption = "X Pos = " & MouseLoc.X
  59.     LabelY.Caption = "Y Pos = " & MouseLoc.Y
  60. End Sub
  61.