chthomas
06-26-2000, 04:15 AM
Hi,
Any one knows how to change the mouse pointer to a new shape when it moves over a command button in Access. I did manage to get the API code from Dev Ashish's site, but not sure how to use it. Also found an article on Mouspointer property in help menu. I checked the properties of the command button and form , but could not find any such property.
Any suggestions or help or sample db will be highly appreciated.
Thanks and Regards
Charley
RpbertS
06-26-2000, 07:22 AM
Well first off you would have to know when the mouse pointer is over a cmd button so :
-------
Private Sub buttonname_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
end sub
-------
post dev ashish's code , maybe I can hepl you work through the rest of the problem
chthomas
06-27-2000, 03:40 AM
'API: Displaying a custom Mouse icon
'Access allows us to display specific mouse 'pointers by controlling the MousePointer 'property of the Application object. 'However, it does not have the hand pointer '(for example) pre-defined.
'Given a local ICO (icon) file, we can 'assign it to the Mouse pointer by using
'the LoadCursor and SetCursor API functions.
'*********** Code Start ************
'Code Courtesy of
'Terry Kreft
'
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
'*********** Code End ************
Databasenow
07-05-2000, 07:12 AM
I tried this code also. I want to create "fake" hyperlinks for my user interface.
I get the following error:
The expression On Mouse Move you entered as the event property setting produced the following error: Only comments may appear after End Sub, End Function, or End Property.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.
fernin8r
06-14-2005, 01:41 PM
Could someone please explain how to use this API to change my mouse to a hand in the OnMouseMove Command?
Right now I copied the code to a module and call the module Mouse_Pointer
then, I went to the OnMouseMove Command for a textbox and type:
Call Mouse_Pointer.????? -----> This is where I get stuck.
Which Function do I call and what variable do I pass that function to change my mouse to a hand?
Thanks
Specterman
11-28-2006, 12:30 PM
Cut and paste the code in a module.
On the MouseMove event of your object (textbox, button,etc...), write the code:
Call MouseCursor(IDC_Hand)
Replace "IDC_Hand" with whatever the variable name is for the mousepointer you want to show.
I tried this and it works. ;)
Dreamweaver
11-28-2006, 01:34 PM
The Codes On Thios site and in the downloadable version of the site
http://www.mvps.org/access/