CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Disable mouse

  1. #1
    Join Date
    Mar 2001
    Posts
    31

    Disable mouse

    hi all
    i am developing an application to control the RSLogix
    Vb program will start and do all the required commands.

    in meantime i do not want the user to access the application by mouse or keyboard by interventing the controlling process.

    how can i do this i am unable to find a solution?

    Any suggestion will be of great help

    thanks
    roopa

  2. #2
    Join Date
    May 2002
    Location
    Colombo,Sri Lanka
    Posts
    1,110
    Dim x0 As Long
    Dim y0 As Long
    Dim b As Boolean
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Type POINTAPI
    X As Long
    Y As Long
    End Type
    Private Sub Command1_Click()
    b = True
    Dim pt As POINTAPI
    GetCursorPos pt
    x0 = pt.X
    y0 = pt.Y
    End Sub
    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If b Then SetCursorPos x0, y0
    End Sub
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If b Then SetCursorPos x0, y0
    End Sub

    or you can also Hide the mouse cursor using ShowCursor API

    Public Declare Function ShowCursor Lib "user32" (ByVal lShow As Long) As Long

  3. #3
    Join Date
    Mar 2001
    Posts
    31
    Show cursor works only within the Vb application.
    my vb application will be running in the taskbar it is just a controller the main application is the RSLogix software which i am controlling
    thanks
    roopa


    Originally posted by dinesh123
    Dim x0 As Long
    Dim y0 As Long
    Dim b As Boolean
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Type POINTAPI
    X As Long
    Y As Long
    End Type
    Private Sub Command1_Click()
    b = True
    Dim pt As POINTAPI
    GetCursorPos pt
    x0 = pt.X
    y0 = pt.Y
    End Sub
    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If b Then SetCursorPos x0, y0
    End Sub
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If b Then SetCursorPos x0, y0
    End Sub

    or you can also Hide the mouse cursor using ShowCursor API

    Public Declare Function ShowCursor Lib "user32" (ByVal lShow As Long) As Long

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured