How to disable mouse wheel?

N

Norm

Hi All,

I'm building a project using Access 2002 with VBA. I need to disable the
mouse wheel to prevent users from accidently changing records, and came
across Stephen Lebans .dll solution. It looks like it's exactly what I
need, except when I call the function MouseWheelOFF() in his code, it
returns False. This is frustrating because it works in his demo program,
and I know lots of others are using it with success.

I don't know if it makes a difference, but the main form in which I want to
disable mouse wheel record scrolling is tabbed.

Please...any help or suggestions?

Thanks,
Norm
 
S

Stephen Lebans

It should not really be possible to not have an error message pop up
telling you it is missing the MouseHook DLL for the function to return
FALSE.
THe latest version on my site does support TAB controls. Are you using
the latest version dated Feb 26,2004?

Finally, which Form Event are you calling the function from?
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
N

Norm

Thank you for replying Stephen.

Actually, the function that is returning FALSE is in the DLL, called
StopMouseWheel(). The MouseHook DLL is being found, and it is the
correct version.

I am calling MouseWheelOFF() from the Form_Open event.

Norm


"Stephen Lebans" <ForEmailGotoMy.WebSite.-
(e-mail address removed)> wrote in @TK2MSFTNGP10.phx.gbl:
 
S

Stephen Lebans

I just tried it from the Form's Open event and it works fine here on:
A97/Win98
A2K/Win2K
A2K2/WinXP Pro

Can you send me your MDB that exhibits this behaviour and I will take a
look at it for you.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

I attempted using MouseHook but gave it up for MouseTrap.

Moustrap is perhaps not as good as mousehook in that it
doesn't blanket the entire program like Mousehook. But
Mouse trap works 100% on all types of controls where
MouseHook still allowed scrolling on checkboxes. I was
told this was going to be fixed over a weekend. But I
dont think it has been.
 
S

Stephen Lebans

How are you anyway?

MouseHook does work properly with CheckBox controls. You said you could
not get the code to work with your own MDB but that the sample Form
worked. Are you now telling me that the sample form did not work.

As I state on the MouseHook Web page:

**Remember to remove any existing instances of the MouseHook.DLL from
your system. When you call the code from your Form it first looks into
your Windows/System folder for the MouseHook.DLL. If it is not found
then it will look into the folder where the current MDB resides. This
means if you copy the newest version of the DLL into your application
folder but still have an older version in your Windows/System folder the
OLDER version will be used!**



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
P

Phil

I'm running into something similar - the MouseWheelOFF
does not function properly - but with a different twist.

I have the MouseWheelOFF attached to the OnLoad event of
a the form that is the startup form of my program, and
use the MouseWheelON when that form closes (it closes
when the application shuts down).

I want to affect a bound form...stop the itellimouse from
functioning. With the code attached as mentioned above,
the mouse wheel will actually scroll for 1 record, then
not be functional. I would like the mouse wheel to not
ever be functional during the scrolling of records on
this form and for the total running of the application.

Any suggestions? Thanks,
 
P

phil

I might also mention that the bound form has a subform -
but I don't know if this makes any difference as the
mousewheelOFF is supposed to work for all forms once it
is run (correct?)

Phil
 
P

phil

OK - here's what I can boil it down to:

When I load the bound form, then click on the tab control
that is in the form and has the record information, the
mouse wheel works once to go either to the next or
previous record. I have the user use a "Find" form to
get to another record (the navigator buttons are not
visible).

Hope all that helps to pinpoint why the mousewheel is not
functioning as expected.
 
S

Stephen Lebans

Phil I asked a question in my Email to you. What version of the DLL are
you using? Please ensure you are not only downloading but actually using
the latest version of the DLL. As per the MouseHook's Web page:

**Remember to remove any existing instances of the MouseHook.DLL from
your system. When you call the code from your Form it first looks into
your Windows/System folder for the MouseHook.DLL. If it is not found
then it will look into the folder where the current MDB resides. This
means if you copy the newest version of the DLL into your application
folder but still have an older version in your Windows/System folder the
OLDER version will be used!**

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
P

phil

The .dll I'm using is from the lebans download page
(A2KMouseHook.zip) and is dated 2/26/04. I think this is
the latest.

I've never used it, and it is located in the file with my
database.

I checked all files and folders on the PC, and it is the
only .dll named MouseHook

Hope that helps,
Phil
 
S

Stephen Lebans

Phil can you send me your MDB then I can try to debug it here.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
T

TC

Hi Stephen

Jumping in here, have you considered using win32 Load/FreeLibrary to load
your custom DLLs from an application-specific directory? It's a really easy
way of not having to put anything in the standard system directories. For
example, it is really easy (using this method) to put all of an
application's custom DLLs, into the same directory as the application.

- Have >no< path in the Declare statement.
- At runtime, load the DLL with:
hDLL = LoadLibrary ("full pathname of DLL")
- Then invoke the DLL functions as usual.
- When finished, call FreeLibrary(hDLL).

The only thing that I'm not sure of, is what happens if someone has already
invoked some other version of the DLL (from some other location). I don't
know whether the LoadLibrary call replaces that other version (in memory),
or is ignored, or returns a runtime error.

Apologies if you know all this already!

Cheers,
TC


"Stephen Lebans" <[email protected]>
wrote in message
(snip)
 
S

Stephen Lebans

TC I am already doing that to enable the DLL to load from the same
folder as wherever the MDB resides.
With XP or later the DLL really should be placed in the same folder as
the MDB.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
P

phil

Hi Steve - I sent some code to you email address. Let me
know what you find...

Thanks,
Phil
 
S

Stephen Lebans

Phillip I found the bug and it was 100% my error. I had mistakenly
commented out support for Forms in Popup view for the last release. I
have added support back in and your MDB works fine now.

You may need to click on Refresh when you go to the Mousehook page to
download the new relase. Make sure the DLL is dated today, March 02 at
4:31pm.
:)


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
P

phil

To all - code now works great - I highly recommend it to
stop the itellimouse from scrolling through records on a
bound form.
 
T

TC

Stephen, I don't understand. If you are already using LoadLibrary to
force-load the DLL from the MDB directory, why do you say: "Remember to
remove any existing instances of the MouseHook.DLL from your system. When
you call the code from your Form it first looks into your Windows/System
folder for the MouseHook.DLL. If it is not found then it will look into the
folder where the current MDB resides."

The quoted text implies that the DLL is being loaded from one of a number of
possible different directories, no?

Cheers,
TC
 
S

Stephen Lebans

Most people are used to installing standard DLL's in their
WIndows/System folder and this is the accepted practice prior to WinXP
so I have maintained this logic in my code. It's only if the DLL is not
found in the WIndows/System folder that it then looks in the current
folder containing the MDB.
The code is fully exposed so the user/deveoper is free to change the
order of the search or hard code the path if they so desire. Since the
DLL is free I am merely trying to reduce the number of support requests
I get everyday which really was the basis for developing the DLL instead
of the more common ActiveX approach.
:)
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
N

Norm

Stephen,

I had started this thread, and found a line of my code that had
prevented MouseHook from working. However, I don't understand why this
code would break the DLL.

The single line of problem code was an if-statement that set the focus
to a button on the form. The statement was being evaluated as true.
Since I eliminated that statement, the DLL is working great!

Thank you for taking the time to personally respond to my inquiry.

Best,
Norm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

mouse scroll wheel 9
Disable scroll w/Mouse wheel 1
Mouse Scroll Wheel 10
Disable wheel mouse in a form 1
Disable Mouse wheel scrolling 1
Disable Scroll Mouse 4
Disable the mouse wheel 1
Disable the mouse wheel 1

Top