标题:[求助]如何实现预览鼠标指针?
只看楼主
freeshadow
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-8-23
 问题点数:0 回复次数:7 
[求助]如何实现预览鼠标指针?
我想在窗口上放一个图片框,然后再放一些图象框在里面,让每个图象框都可以显示鼠标指针图像,用loadpicture无法读取指针格式的文件,也没有查到相关的api函数,请问这种效果怎样才能实现?用怎样的api函数?能否给个实例?

[此贴子已经被作者于2007-8-29 12:10:56编辑过]


搜索更多相关主题的帖子: 鼠标 指针 预览 api 图象 
2007-08-28 17:00
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
得分:0 
2007-08-28 17:05
BEARBEN
Rank: 1
等 级:新手上路
帖 子:114
专家分:0
注 册:2007-7-7
得分:0 
我有一个实现ANI格式的鼠标指针的程序,我记不得哪里下的了,LZ要的话加我的QQ:453628001

2007-08-28 17:54
Joforn
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1242
专家分:122
注 册:2007-1-2
得分:0 
Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GCL_HCURSOR = (-12)

VB QQ群:47715789
2007-08-29 00:06
freeshadow
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-8-23
得分:0 
以上各位,能不能给各实例阿?光是api函数我也不太清楚怎样用
2007-08-29 12:12
multiple19O2
Rank: 1
等 级:新手上路
帖 子:326
专家分:0
注 册:2007-8-29
得分:0 

Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GCL_HCURSOR = (-12)

基本看懂了
先Load(filename) as long得到载入后的图标的句柄
然后用SetClassLong(hWnd,GCL_HCURSOR,那个句柄here)放进Picturebox之类的
最后不用的时候DestroyCursor
SetClassLong的解释可能不够准确


顺便提一句,destory的过去式和过去分词都是destroyed,不是destroied.

2007-08-29 12:18
Joforn
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1242
专家分:122
注 册:2007-1-2
得分:0 
呵,我以前发的API函数查询管理器里面有好几个实例,其中还有一个是用LoadCursor来实现的。

VB QQ群:47715789
2007-08-29 12:54
freeshadow
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-8-23
得分:0 
以下是引用multiple19O2在2007-8-29 12:18:03的发言:

Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GCL_HCURSOR = (-12)

基本看懂了
先Load(filename) as long得到载入后的图标的句柄
然后用SetClassLong(hWnd,GCL_HCURSOR,那个句柄here)放进Picturebox之类的
最后不用的时候DestroyCursor
SetClassLong的解释可能不够准确


顺便提一句,destory的过去式和过去分词都是destroyed,不是destroied.


可是如何放进imagebox并让它显示出来呢?使用loadpicture吗?

2007-08-30 15:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-166054-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033703 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved