disable the mouse - working first time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhishek Bhatt
    New Member
    • Sep 2007
    • 36

    disable the mouse - working first time

    I need to disable the mouse on click of ADD button.
    I wrote following code for that

    Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

    on click of ADD
    ShowCursor false

    after ADD opertaion is finished
    ShowCursor true

    This is wroking when I click the ADD button for first time. But when I click on ADD button again it does not work.
    Any idea why it's behaving like that?
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    ShowCursor (Hide and Show ) are to be used as a Couple.
    Means if you call the ShowCursor function more than once passing False as an argument, then you must call ShowCursor with True an equal number of times, otherwise the cursor may remain Invisible/Visible depending on how many times u have passed which argument.

    It is always a better Idea to write Seperate Subprocedures to Show and Hide. Keep a FormLevel Variable and if the Cursor is already hidden (Check the Variable) then do not do anything, Exit Sub, Else Hide. Do Same for Showing the cursor..

    Regards
    Veena

    Comment

    Working...