乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 36|回复: 1

vba里面可以控制鼠标的形状吗?

[复制链接]

7

主题

10

帖子

2

银币

初来乍到

Rank: 1

铜币
38
发表于 2003-12-1 11:52:00 | 显示全部楼层 |阅读模式
回复

使用道具 举报

26

主题

589

帖子

10

银币

中流砥柱

Rank: 25

铜币
693
发表于 2003-12-1 12:41:00 | 显示全部楼层
下面的是一个VB的示例,供参考吧。
  1. Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
  2. Private Declare Function SetClassWord Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal wNewWord As Long) As Long
  3. Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
  4. Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
  5. Const GCW_HCURSOR = (-12)
  6. Const IDC_SIZEALL = 32646&
  7. Dim SysCursHandle As Long, Curs1Handle As Long, Curs2Handle As Long
  8. Private Sub Form_Load()
  9.     'KPD-Team 1999
  10.     'URL: http://www.allapi.net/
  11.     'E-Mail: KPDTeam@Allapi.net
  12.     'Load a default cursor
  13.     Curs1Handle = LoadCursor(ByVal 0&, IDC_SIZEALL)
  14.     'Load a cursor from a file
  15.     Curs2Handle = LoadCursorFromFile("C:\Windows\Cursors\pen_1.cur")
  16.     'Set the form's mouse cursor
  17.     SysCursHandle = SetClassWord(Me.hwnd, GCW_HCURSOR, Curs1Handle)
  18.     'Set the button's cursor
  19.     SysCursHandle = SetClassWord(Command1.hwnd, GCW_HCURSOR, Curs2Handle)
  20. End Sub
  21. Private Sub Form_Unload(Cancel As Integer)
  22.     'Set the form's cursor back to the original cursor
  23.     SetClassWord Me.hwnd, GCW_HCURSOR, SysCursHandle
  24.     'Clean up
  25.     DestroyCursor Curs1Handle
  26.     DestroyCursor Curs2Handle
  27. End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-6-29 14:17 , Processed in 1.440919 second(s), 57 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表