Win95的動畫鼠標為應用程序增色不少,而VB則只提供一般的鼠標圖標支持。要用VB顯示動畫鼠標形狀,你可以使用以下方法:
函數聲明:
PublicConstGCL_HCURSOR=-12
DeclareFunctionClipCursorLib"user32"(lpRectAsAny)AsLong
DeclareFunctionDestroyCursorLib"user32"(ByValhCursorAsAny)AsLong
DeclareFunctionLoadCursorFromFileLib"user32"Alias"LoadCursorFromFileA"(ByVal
lpFileNameAsString)AsLong
DeclareFunctionSetClassLongLib"user32"Alias"SetClassLongA"(ByValhwndAsLong,
ByValnIndexAsLong,ByValdwNewLongAsLong)AsLong
DeclareFunctionGetClassLongLib"user32"Alias"GetClassLongA"(ByValhwndAsLong,
ByValnIndexAsLong)AsLong
使用:
DimmhBaseCursorAsLong,mhAniCursorAsLong
DimlResultAsLong
mhAniCursor=LoadCursorFromFile("c:windowscursorsappstart.ani")
lResult=SetClassLong((hwnd),GCL_HCURSOR,mhAniCursor)->