Solved

Mouse Control

Posted on 2000-05-03
9
160 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
  • 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
 

Expert Comment

by:AshokKumar
ID: 2779495
Thanks Friend. Really nice working for u.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now