请问用什么函数或方法可以使自定义的系统鼠标方案立即生效?

lclean 2005-10-28 10:45:58
我先将鼠标路径逐一添如注册标,然后在form1中添加一个按钮,点击按钮使鼠标方案立即生效,请问用什么函数或方法?谢谢!
...全文
246 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2005-10-31
  • 打赏
  • 举报
回复
'2 API:
'ADD A BLANK FORM AND PASTE THE FOLLOWING CODES TO IT ,THEN LEFT MOUSE DOWN OR RIGHT MOUSE DOWN

Option Explicit

Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Private Const OCR_NORMAL = 32512

Dim newcursor As Long
Dim cursors As New Collection

Sub loadcursors() ' load cursors from system
Dim mydir As String, fname As String

mydir = Environ("windir") & "\cursors\"
fname = Dir(mydir)
Do While fname <> ""
cursors.Add mydir & fname
fname = Dir
Loop
End Sub

Sub loaddefaultcursor()
Dim defaultcursor As Long ' set default system cursor
defaultcursor = LoadCursorFromFile(Environ("windir") & "\cursors\arrow_l.cur")
SetSystemCursor defaultcursor, OCR_NORMAL
End Sub
Sub loadnewcursor() ' set a new system cursor
Dim cursorfile As String
Randomize
cursorfile = cursors(Int(Rnd * cursors.Count + 1)) 'random cursor file
newcursor = LoadCursorFromFile(cursorfile)
SetSystemCursor newcursor, OCR_NORMAL
Me.Caption = cursorfile
End Sub
Private Sub Form_Load()
loadcursors
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then loadnewcursor
If Button = 2 Then loaddefaultcursor
End Sub

Private Sub Form_Unload(Cancel As Integer) ' default system cursor
loaddefaultcursor
End Sub






lclean 2005-10-30
  • 打赏
  • 举报
回复
老大帮帮忙!
lclean 2005-10-30
  • 打赏
  • 举报
回复
不好意思 指的是使自定义的系统鼠标方案立即生效,不是me的指针
偶先把路径添到注册表里,然后怎样使它立即生效?
faysky2 2005-10-30
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
dim filePath as String
filePath=从注册表中得到文件名及路径
Me.MousePointer = 99
Me.MouseIcon = filePath
End Sub
zodane 2005-10-29
  • 打赏
  • 举报
回复
晕倒 ,用键盘控制触发的才是change ,用鼠标控制的是click ,所以你说怎么会有反应?
juanhyy 2005-10-29
  • 打赏
  • 举报
回复
請問﹐有什么方法可以讓一個combobox去觸發另外一個combobox,我寫change事件下怎么沒反映?
lclean 2005-10-29
  • 打赏
  • 举报
回复
请大虾帮帮忙!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧