こんにちわ。
タイトルの通りですが、MouseIcon、MousePointerプロパティを使い、Label1_Click時にカーソルのアイコンがHTMLリンクをクリックしたときの「手のアイコン」になるようにしたいのですが、Windows内にそのアイコンが存在しません。教えていただけますか?
私も知りたいです。
以前同じ問題で悩んだときは、時間もなかったので
自分で指のアイコンを作りました・・
私のPCはXP pro SP1ですが
C:\Windos\Cursors内にあるマウスアイコンのことでしょうか?
XP以外の環境は知りませんが。。。
ファイルでは存在しません。DLL内にあります。
LoadImageでも読み込むことは可能ですが、LoadCursorで定数指定で
比較的簡単に取得できますのでそのサンプルです。
Private Type PictDesc
cbSize As Long
picType As PictureTypeConstants
hIcon As Long
End Type
Private Type RIID
id(16) As Byte
End Type
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" _
(lpPictDesc As PictDesc, _
iid As RIID, _
ByVal fPictureOwnsHandle As Long, _
ipic As IPicture) As Long
Private Const IDC_HAND = 32649&
Private hCur As Long
Private Sub Form_Load()
hCur = LoadCursor(0, IDC_HAND)
Me.MousePointer = 99
Me.MouseIcon = IconToIPicture(hCur)
End Sub
Private Function IconToIPicture(hIcon As Long) As IPictureDisp
Dim pic As PictDesc
Dim ipic As IPictureDisp
Dim IID_IDispatch As RIID
Dim ret As Long
IID_IDispatch.id(8) = &HC0
IID_IDispatch.id(15) = &H46
With pic
.cbSize = Len(pic)
.picType = vbPicTypeIcon
.hIcon = hIcon
End With
ret = OleCreatePictureIndirect(pic, IID_IDispatch, 1, ipic)
Set IconToIPicture = ipic
End Function
確認遅くなりました。上記の方法で解決です。
りりっとさんありがとうございます。
ツイート | ![]() |