Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change pointer to hand without hyperlink

Status
Not open for further replies.

MackC

Programmer
Nov 8, 2001
23
0
0
US
I am trying to use the following custom mouse pointer code posted on the "Access Web" web site. I want to call the MouseCursor function from the MouseMove event of a text box to display a hand pointer when the mouse moves over the text box. I don?t want to use the PointM function because I am distributing my database to many different users, who may not have the ICO file. The MouseCursor function works fine to display an arrow, cross, or Ibeam, but not the hand. When I specify 32649 or IDC_HAND, the cursor just disappears when I move the pointer over the text box. I have Access 2000 and Windows NT 4.0. Does anyone know what might be causing this problem?

Public Const IDC_APPSTARTING = 32650&
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&
Public Const IDC_CROSS = 32515&
Public Const IDC_IBEAM = 32513&
Public Const IDC_ICON = 32641&
Public Const IDC_NO = 32648&
Public Const IDC_SIZE = 32640&
Public Const IDC_SIZEALL = 32646&
Public Const IDC_SIZENESW = 32643&
Public Const IDC_SIZENS = 32645&
Public Const IDC_SIZENWSE = 32642&
Public Const IDC_SIZEWE = 32644&
Public Const IDC_UPARROW = 32516&
Public Const IDC_WAIT = 32514&

Declare Function LoadCursorBynum Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

Declare Function LoadCursorFromFile Lib "user32" Alias _
"LoadCursorFromFileA" (ByVal lpFileName As String) As Long

Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long

Function MouseCursor(CursorType As Long)
Dim lngRet As Long
lngRet = LoadCursorBynum(0&, CursorType)
lngRet = SetCursor(lngRet)
End Function

Function PointM(strPathToCursor As String)
Dim lngRet As Long
lngRet = LoadCursorFromFile(strPathToCursor)
lngRet = SetCursor(lngRet)
End Function
 
I think you are right, vbajock. I tried it in Windows 2000 and it worked as expected, but it failed on Windows 95. Could someone test it in Windows 98, ME, and XP? All you need to do is put the code in a standard module and add the following to the MouseMove event of a text box:
=MouseCursor(32649)
Thanks
 
I wish I had time. Your calling user32.dll in your API, so I would check the file dates on \System32\user32.dll on the machines that work and compare them to the NT box. First, I would apply the latest Service Pack/Windows Update stuff, that might fix it. Check the date of User32 again after you do it.

If that doesn't work you'll have to try copying the new one over to the NT box. You might have to create a disk to boot NT to DOS mode so you can copy the file - in GUI mode I bet that file is in use. Back up the original first. NT doesn't have a safe mode so it could get ugly. I would bet the paycheck on this being the fix as the pointers are in this file and the old one probably just doesn't have the pointer your looking for in it.
 
Based on my research, here are the limitations of using Terry Kreft's custom mouse pointer functions to change the mouse pointer to a hand (see the code I posted earlier). The MouseCursor function does not work reliably in Windows 95 or Windows NT 4.0. It does apparently work in Windows 98 and later versions. The PointM function is also of limited usefulness if you plan to distribute your application to users with different versions of Windows because the folder location and name of the hand cursor file vary from version to version.
 
if u are still wondering wether it works in XP or not..well..good news..it works!! Thanks for the most greatest code in the world..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top