Solved

Mouse Control

Posted on 2000-05-03
9
164 Views
Last Modified: 2010-05-02
hello Experts,

Is there a way I can disable a mouse  function once i go into the form ?
0
Comment
Question by:dekoay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2776358
which function do you want to disable?
0
 

Accepted Solution

by:
AshokKumar earned 50 total points
ID: 2776415
Yes. U can do that. If u want to manipulate cursor alone ie to hide it u can use ShowCursor API call. If u want to disable the right clikc event or something like that use this:

---------Module COde-----

Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_WNDPROC = -4
Public Const WM_RBUTTONUP = &H205
Public lpPrevWndProc As Long
Private lngHWnd As Long
Public Sub Hook(hWnd As Long)
lngHWnd = hWnd
lpPrevWndProc = SetWindowLong(lngHWnd, GWL_WNDPROC, _
AddressOf WindowProc)
End Sub
Public Sub UnHook()
Dim lngReturnValue As Long
lngReturnValue = SetWindowLong(lngHWnd, GWL_WNDPROC, lpPrevWndProc)
End Sub
Function WindowProc(ByVal hw As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_RBUTTONUP
'Do nothing
'Or popup you own menu
Case Else
WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
End Select
End Function
---------

Form Code
---------
Private Sub Form_Load()
Call Hook(Text1.hWnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call UnHook
End Sub
-----------


This would give u an idea.
0
 
LVL 6

Expert Comment

by:setiawan
ID: 2776577
Hi dekoay,

What about hide the cursor ?

'put in the module
Declare Function ShowCursor& Lib "user32" _
    (ByVal bShow As Long)
    'Add this code to Command1.


Private Sub Command1_Click()
    ShowCursor (bShow = True)
End Sub

Private Sub Command2_Click()
    ShowCursor (bShow = False)
End Sub

hope this helps

  danny
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Expert Comment

by:AshokKumar
ID: 2779495
Thanks Friend. Really nice working for u.
0
 

Expert Comment

by:wzm
ID: 2791135
Gee ..
Ashok your code was cool .. Never seen
released on Net b4

Yet i wonder to how to disable
all the text boxes, combos, and command buttons which is commonly used on usual form.I try to hook with lengthy parameter (controls'name) and oops ...you know what have i incurred ..

Wzm



0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2791144
you disable those objects by just setting there .enabled property to false
0
 

Expert Comment

by:wzm
ID: 2791200
Dear AzraSound

That's not the idea ...
TQ very much for the prompt respond.

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2791213
what is the idea?  theres no need to subclass those objects since they have a direct property to prevent the user from editing them.
0
 

Author Comment

by:dekoay
ID: 2791733
Hello wzm,
Perhaps I should u r wrong. The idea for disabling mouse is not allow user to use them.Instead, they use tab key to move from field to field for editing.

Dekoay
:)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question