I have a project that can display a lot of data in a form. The form has a scrollbar on one side and I can click on the scrollbar and move up or down in the data.
My question: How can I activate my mouse's scrollwheel so that I can roll the scroll wheel and move up or down in the data?
Try the first post in this thread, but substitute the scroll bar's hwnd for Me.hwnd in the FormLoad sub.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
I tried your suggestions, but they did not work. I ended up downloaded a file from Microsoft's site that installed Microsoft Intelliware 4.12 and that did the trick for me.
I appreciate your offers of help.....keep up the good work!
You can do it with the code i linked to - you'd have to modify it though.
Bear in mind that if you give your app to anyone else it might not work for them. if it's just for you then updating the driver is ok - if it's for other people then you'll have to handle the messages yourself.
I'm thinking perhaps I didn't modify your code correctly. Can you tell me where I'd modify the code, if my form was named "ThisIsJustATest", and the field I am interested in is "FieldThisIsAField" ??
Would I have to put the "CallWheelHook" into every field, or just at the beginning of a form?
Great piece of code/example. However I think I found a bug.
The error is
Code:
Runtime Error 91
Object variable or with block variable not set
The steps to generate the error are:
1) Place a textbox inside a picturebox.
2) click inside the textbox and rotate the wheel. (Which is obviously ignored by your MouseWheel event.) (everything is still fine)
2) move the mouse outside the bounds of the textbox (in my case pointer is now over picturebox) but DO NOT click the mouse.
3) Error is generated when you roll the mousewheel over the picturebox.
I suspect your routine thinks it's still over the textbox, and has to do with VB not detecting when the mouse leaves the bounds of a control too well?
Regards,
Nap
PS.. Wish I could fix it for you, but I'm not that skilled with API code. But would love it if you found the answer ASAP.
I have been able to eliminate the error from occuring some of the time by:
Code:
picturebox_mousemove (....)
picturebox.setfocus
end sub
But the error still occurs when there is a small gap between textboxes and you happen to be scrolling while the mouse moves over the gap. As I said b4, VB isn't good at detecting when the mouse moves off the control.
Understand about the texbox. The error happens when you give the textbox focus and then move off it without clicking the mouse over the next control it's hovering over.
everything is working, except when there is a transition of the mouse over controls. If you move too quick and rotate the wheel while you're doing it, the error is generated.