form1.frm

来自「大量优秀的vb编程」· FRM 代码 · 共 96 行

FRM
96
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "动画指针"
   ClientHeight    =   2220
   ClientLeft      =   912
   ClientTop       =   1332
   ClientWidth     =   3804
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2220
   ScaleWidth      =   3804
   Begin VB.CommandButton Command3 
      Caption         =   "退出程序"
      Height          =   396
      Left            =   2280
      TabIndex        =   3
      Top             =   1440
      Width           =   972
   End
   Begin VB.TextBox Text1 
      Height          =   864
      Left            =   108
      MultiLine       =   -1  'True
      TabIndex        =   2
      Text            =   "Form1.frx":0000
      Top             =   372
      Width           =   3540
   End
   Begin VB.CommandButton Command2 
      Caption         =   "普通指针"
      Height          =   396
      Left            =   1320
      TabIndex        =   1
      Top             =   1440
      Width           =   972
   End
   Begin VB.CommandButton Command1 
      Caption         =   "动画指针"
      Height          =   396
      Left            =   360
      TabIndex        =   0
      Top             =   1440
      Width           =   972
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mhBaseCursor As Long, mhAniCursor As Long
Dim mhBaseCursor2 As Long, mhAniCursor2 As Long
Dim state As Integer
Private Sub Command1_Click()
    Dim lResult As Long
    
    mhAniCursor = LoadCursorFromFile(App.Path & "\globe.ani")
    '为窗口类设置一个Long变量条目
    lResult = SetClassLong((hwnd), GCL_HCURSOR, mhAniCursor)
    state = 1
    
    mhAniCursor2 = LoadCursorFromFile(App.Path & "\hourglas.ani")
    lResult = SetClassLong((Text1.hwnd), GCL_HCURSOR, mhAniCursor2)
    state = 1
End Sub

Private Sub Command2_Click()
    Dim lResult As Long
    
    lResult = SetClassLong((hwnd), GCL_HCURSOR, mhBaseCursor)
    lResult = DestroyCursor(mhAniCursor)
    
    lResult = SetClassLong((Text1.hwnd), GCL_HCURSOR, mhBaseCursor2)
    lResult = DestroyCursor(mhAniCursor2)
    state = 0
End Sub


Private Sub Command3_Click()
    End
End Sub

Private Sub Form_Load()

    mhBaseCursor = GetClassLong((hwnd), GCL_HCURSOR)
    mhBaseCursor2 = GetClassLong((hwnd), GCL_HCURSOR)
End Sub


Private Sub Form_Unload(Cancel As Integer)
    If state Then Command2_Click
End Sub


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?