How do I set the mouse pointer in Access?

Source: Internet
Author: User
Tags file copy
access| mouse pointer
How do I set the mouse pointer in Access?



Problem:

How do I set the mouse pointer?



Method One:

Private Declare Function alxsetcursor Lib "user32" Alias "SetCursor" (ByVal hcursor as long) as long
' Sets the specified mouse pointer to the current pointer
Private Declare Function alxgetcursor Lib "user32" Alias "GetCursor" () as Long
' Get the handle of the currently selected mouse pointer


Private Sub Mousetype ()
' Get the value of the left and right cursor
Screen.MousePointer = 9 ' Set screen mouse to 9 (left-right mouse).
Lngmouseone = Alxgetcursor () ' Returns the value of the left-right mouse in Windows (2000\98\XP).
Screen.MousePointer = 7 ' Set screen mouse to 11 (hourglass).
Lngmousetwo = Alxgetcursor () ' Returns the value of the left-right mouse in Windows (2000\98\XP).
Screen.MousePointer = 0 ' Reset screen mouse is 0 (access is self-determined).
Bltextout = False
Bltextlook = False
End Sub






Method Two:


Just find one. cur file copy to the same directory as the MDB file
Private Declare Function copycursor Lib "user32" Alias "Copyicon" (ByVal hcur as long) as long
Private Declare Function loadcursorfromfile Lib "user32" Alias "Loadcursorfromfilea" (ByVal Lpstrcurfile as String) as Lon G
Private Declare Function getcursor Lib "user32" () as Long
Private Declare Function setsystemcursor Lib "user32" (ByVal hcur as long, ByVal ID as long) as long
Private Const ocr_normal = 32512


Dim Lngmycursor as Long
Dim Lngsystemcursor as Long


Private Sub cmdmycursor_click () Change pointer style
Dim Strcurfile as String
Strcurfile = Currentproject.path + "\cursor.cur"
' You can call other. Cur mouse style files to achieve the purpose of displaying various pointers
Lngmycursor = Loadcursorfromfile (strcurfile)
Lngsystemcursor = GetCursor ()
Lngsystemcursor = Copycursor (lngsystemcursor)
Setsystemcursor Lngmycursor, Ocr_normal
Text1.setfocus
Text1.Text = "The mouse pointer is already set to the state you want"
cmdmycursor.enabled = False
cmdsystemcursor.enabled = True
End Sub


Private Sub Cmdsystemcursor_click () restore system pointer style
Setsystemcursor Lngsystemcursor, Ocr_normal
Text1.setfocus
Text1.Text = "The mouse pointer has been restored to the system State"
cmdmycursor.enabled = True
cmdsystemcursor.enabled = False
Lngsystemcursor = 0
End Sub

Private Sub Form_close ()
If lngsystemcursor <> 0 Then setsystemcursor lngsystemcursor, Ocr_normal
End Sub

Private Sub form_unload (Cancel as Integer)
If lngsystemcursor <> 0 Then setsystemcursor lngsystemcursor, Ocr_normal
End Sub





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.