VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 如何将的游标显示成动画游标
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:10971, 日期:2001-09-17
 如何将的游标显示成动画游标


作者: 王国荣 

  动画在 Windows 底下是 .ani 格式的档案, 要显示此类游标, 首先要利用
LoadCursorFromFile API 载入.ani 档案, 然後利用 SetSystemCursor API 加以显示,


Const OCR_NORMAL = 32512
Const IDC_ARROW = 32512&

Private Declare Function LoadCursorFromFile Lib "user32" Alias _
        "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function LoadCursor Lib "user32" Alias " LoadCursorA" _
       (ByVal hInstance As Long, lpCursorName As Any) As Long 注释: modified
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, _
        ByVal id As Long) As Long


Dim hCursor As Long

hCursor = LoadCursorFromFile( 欲显示的 .ani 或 .cur 档案名称 )
Call SetSystemCursor(hCursor, OCR_NORMAL)

若要将鼠标游标还原原状, 则是执行以下叙述:

hCursor = LoadCursor(0&, ByVal IDC_ARROW)
Call SetSystemCursor(hCursor, OCR_NORMAL)