-
[RESOLVED] MouseUp in ActiveX - works in IDE but not in exe
Hello Guys.
I have this strange problem. Just finished an activeX control involving a pictureBox. I have exposed PictureBox's MouseUp event.
When I run it in VB IDE, it works fine, shows a message box which I have programmed on MouseUp event.
But when I run the exe, after making the project, outside VB 6.0 IDE, MouseUp does just nothing.
I have tried a lot of stuff, including uninstalling/unregistering previous versions of control, deleting and adding correct ocx to toolbox etc. But problem is not getting solved. It has been 3 days now since I am fighting with it. I think when exe runs, it is not using proper ocx, but I have not been able able to either prove or disprove this hunch.
Thanks for your time.
p.s. I have tried posts with similar title without success.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
try registering the OCX Manually with Regsrv32. Use the same with /u to uninstall manually.
Also during the creation of the setup program, check where setup thinks the ocx should be and make sure after setup that it is where the exe expects it to be.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Thanks for the reply Bill.
I did try manual register/unregister half a dozen of times, keeping ocx at various places.
Installation keeps the ocx at intended place.
Besides, other features are OCX are available. It basically adds MouseWheel to PictureBox. I am processing WM_MOUSEWHEEL. That works fine every time everywhere. It's just MOuseUp that is not working.
Did I make it clear that it was working fine in earlier builds? All mouse and keyboard events have been tested already and they were working ine after installation. Problem started after I
added Container properties to Control and built it again. Then it started working in IDE but not in exe.
Plus, the one person I distributed the app to, ocx MouseUp does not work in IDE as well!! Even if he sets up a beak point, control does not enter the MouseUp procedure.
:( :(
-
Re: MouseUp in ActiveX - works in IDE but not in exe
No one is replying?
Have I messed up the information or the question is hard?
Anyway, I forgot to mention a tiny detail, very important. I apologize:
The demo works only when opened as a group with the ActiveX control project. If opened individually, behaves like exe does.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
This sounds like a tough nut, really.
I suppose you have the latest service packs of everything, too.
Without seeing the code it would be hard to make more than some inspired guesses.
If you know what you added to the previous builds where everything worked fine, you could possibly locate the problem by going back step by step...
I'm not the ocx crack here. The controls I built are always integrated and compiled in the project, so I would never have stumbled over a problem like that.
We have some more experienced ocx-wizards here, like WizBang? Maybe they rise to the challenge?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Have you checked that the mouse driver isn't corrupt.
Also you said that the demo only works when opened as a group. Could you try compiling the OCX in it's own right and then rather than adding it as a group, make a reference to it in the standard project on your dev box where it currently works and check that the OCX still works there.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Why would the mouse then work at all?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Do you use the same OCX in other places in that project? Sounds like a version problem.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Thansks for replies guys.
@Bill: I am sure it is not a mouse diver problem. Thing works in IDE and everything else with mouse works.
@WOF: :)
@dglienna: I am not using that same dll anywhere else in the same project. But ther are many versions lying around on my PC of the OCX from previous builds. I have no idea how many of them are registered. So I think it could be a version problem.
Is there a way to find out all registered OCXs for that control? Would they all be showing up in IDE's toolbox's Component dialog if they are indeed registered? If yes, then I am sure only one control is registered because only one shows up in component dialog.
I am pissed off. Sorry for the language.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
And how would I solve this problem on client's PCs? Some versioning tools for OCXs?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
If I were you, I'd buy Registry Mechanic 2009, and run it. I'd bet that fixes things, or at least provides a valid error. (You could probably install and remove it at the client sites that have problems)
You can search for OCX Remover, but are likely to find snakeoil. I've used RM
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Hi,
I have used a utility to check all the registered files OCXs on the system. Very handy tool. Find it here: http://www.nirsoft.net/utils/registered_dll_view.html
I unregistered and deleted all the entries for my OCX. Then I reinstalled the program with my setup. Only one entry then comes, the one I registered with install. The problem still persists!!
Is there a utility to check which OCX the exe is using at run time? Something like spy++? I think that should help.
Thanks.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
After trying the utility to make sure that only one OCX is registered on PC, I am sure its not a OCX or versioning problem.
I tried spy+ as well, the messages trapped for app run inside as well as outside VB IDE are same. spy+ did not pin point the problem.
So, for a app running outside, spy++ did trap the MouseMove messages, which app does not seem to trap as events.
What could be the issue?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Include a filelog system into your ocx and let it write to a file whenever the mouse has to be catched from the ocx. and in the event so you can see if it gets fired. Write to the same file appending all the time so you can see if the ocx does its work.
Because you ned to find out : is it inside the ocx or outside the event is fired but maybe nor trapped. by your application
IMHO you need to go this way to debug it at real runtime using filelogs and looking what you get there. All others is 'for the fishes' as we say here, because its only a discussion with assumptions but no really databased search.
Quote:
So, for a app running outside, spy++ did trap the MouseMove messages, which app does not seem to trap as events.
Are you sure they come from the ocx, or are they maybe fired from elsewhere and your ocx doesn't even get the mousemoves ? This is why I say log it.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Yes. Logging is a good method to get behind things.
But as stated before, Alex did try to trap the mouseup with a MsgBox in the event handler and found, that the event does not fire.
@Jonny: Say, as having masterly used event hooking and knowing much more about events as I do...
could it be the mouseup event is trapped or hooked by some other program, which does not occur in IDE?
@Alex: I'd say you got to analyze the changes you did to the previous working version and see if some of these are responsible for the effect. You said you put some containers or something, but you were not specific enough about that.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
@Jonny: Ok I will try the Logging thing and other stuff you said, I will have to figure out a way for that, new concept for me.
@WOF: Well I did only this thing related to container: I set the "ControlContainer" property of the User Control to true so that it acts as a container. I have tried running older versions, but same issue is there.
Thanks guys. I am getting new directions because of you people.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Is it possible for me to summon The Wolf somehow (got Marcellus Wallace's no.? )? He is expert in Bonny Situations.
Yes, you are right. I am going crazy.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
How have you exposed the event? And how have you passed the parameters? Showing the code for this may help us resolve the problem. Also, if a control placed inside it has the focus, your event will not fire. This can be overcome of course, but it can get involved.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
@WizBang: Here is how I have exposed the event:
Code:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=Picture1,Picture1,-1,MouseIcon
Public Property Get MouseIcon() As Picture
Set MouseIcon = Picture1.MouseIcon
End Property
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub
Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)
RaiseEvent KeyUp(KeyCode, Shift)
End Sub
Private Sub Picture1_KeyPress(KeyAscii As Integer)
RaiseEvent KeyPress(KeyAscii)
End Sub
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
RaiseEvent KeyDown(KeyCode, Shift)
End Sub
Thanks.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Kick me if I'm wrong, but I don't see any exposure of _MouseUp() event here.
I see _MouseMove() and _MouseDown, but NO _MouseUp()???
-
Re: MouseUp in ActiveX - works in IDE but not in exe
I have to agree with WoF, though I suppose it got missed in the copy/paste.
Anyway, I just made a test OCX, with the event in question, and it worked fine.
What else can you tell us about what the control does?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
@WOF: Oh I am so so sorry. MouseUp is same as MouseDown.
@Jonny: I tried file logging from inside of User Control like this:
Code:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Open "C:\CoontrolLog.txt" For Append As #1
Print #1, "Inside MouseMove. X:" & X & "Y:" & Y
Close #1
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub
The evnts are being logged!!
So User Control is definitely raising events.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
@WizBang: the control basically enhances VB's PictureBox with MouseWheel support.
I have used WM_MOUSEWHEEL message inside control in a module. I have used VBACELLERATOR's SSubTmr6.dll for subclassing.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Hey Guys.
Here is a update. Strange.
I added same file logging code inside Form which has my OCX control in OCX's MouseMove.
The event is logged only when Mouse is clicked!!!
That means, MouseMove of user control in form is called only when mouse is clicked on control!! This is outside VB IDE. Inside works fine.
Contrary to that, MouseMove code in UserControl's code is called everytime, whether i am
running from inside VB IDE or from outside.
Does that make sense, anyone?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
OK, try opening the control's code window, select all and copy. Then open a new, blank control, and paste the code into it. See if the new control behaves differently. If not, try creating a new control, with only the MouseUp event functionality, and see what happens.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
AlexanderSupertramp
@WizBang: the control basically enhances VB's PictureBox with MouseWheel support.
Why not use the UserControl's Picture property to hold the picture, thus eliminating the extra PictureBox control? This may or may not resolve the MouseUp issue, but it would lighten the memory usage if nothing else.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
AlexanderSupertramp
I have used WM_MOUSEWHEEL message inside control in a module. I have used VBACELLERATOR's SSubTmr6.dll for subclassing.
So, you're subclassing the control then? Well, as you probably already know, strange things can happen when attempting this. I would therefore suggest looking up the self-subclassing work of Paul Caton, on PlanetSourceCode.com. It's good stuff.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
WoF
@Jonny: Say, as having masterly used event hooking and knowing much more about events as I do...
could it be the mouseup event is trapped or hooked by some other program, which does not occur in IDE?
.
Hmm.. I have sometimes seen problems when other threads coming in between or if the mainapplication is running enless loops while in between an event should occure But I know to less about which activeX it is and what the mainaipplication does in the time when the event should come in. Or a focus problem could occur even if it seems he is over the control. Thats why I'm asking ik he sees mouse move events occuring, but are they really coming from his control. What sort of activex makes the troubles ?
----
Ok this was before I read the other posts which have come in in a hurry now.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
AlexanderSupertramp
Hey Guys.
Here is a update. Strange.
...
Contrary to that, MouseMove code in UserControl's code is called everytime, whether i am
running from inside VB IDE or from outside.
Does that make sense, anyone?
Yes maybe. What is going on outside of your acticvéX ? Any huge amount of timer events permanently fired or other actions which didn't allow that the activeX is heared. Like an endless loop running there without enough DoEvents in between.
Sometimes an application in the IDE is run only in debug mode and is much slower then in compiled mode and in compiled mode then there is so muck other code running that there is no time to get the activeX event.
Look at the 'traffic' in your application and where you have blocking long running loops always use DoEvents
-
Re: MouseUp in ActiveX - works in IDE but not in exe
@WizBang: But the subclassing part is working perfectly fine. Inside/outside. The problem is with the exposed events of PictureBox control. I'll try something in that direction anyway.
I used PictureBox inside user control because it is supposed to be a Pic and Place replacement for a PictureBox. Just put the new control in a project using a PictureBox, name it as same and it should work. So PictureBox made it easy for me to expose the properties and events.
@Jonny: I am not having many loops in the code. And loops are called at:
1> Form_Load
2> MouseWheel Scroll
So they should not conflict with MouseMove events. am i correct?
@All: You guys are being incredible help to me. Before posting the problem here, I was feeling like Tom Hanks in Cast Away. Even Mr. Wilson wasn't here with me. Thanks a bunch.
Will it help if I post the setup for whole thing over here? Do you guys have time for that?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
AlexanderSupertramp
@---
@Jonny: I am not having many loops in the code. And loops are called at:
....
2> MouseWheel Scroll
So they should not conflict with MouseMove events. am i correct?
Is this a loop for listening ? Can you switch of this one for testing reasons so it would not run ?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
If my hunch is correct, try changing the screen resolution to something normal, like 800x600 or 1024x768 to see if they hard-coded values in
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Since the events of the UserControl fully cover what a PictureBox can do, there really isn't any advantage in also using a PictureBox for your purpose, IMO. And if this resolves the event problem, it'd be worth trying.
If the UserControl is being subclassed, that might explain the interference with the Public event. Though I can't say for certain how the dll you're using may be impacting it, I do know the other method I referred to doesn't cause such a problem.
One thing to try, is to turn off the subclassing, and see if the MouseUp event works. Then you'll know if that's part of the problem.
Feel free to post any part of the project you want, but a mouse event is fairly straight-forward, so there's not much to examine there. I still think it's due to the subclassing.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Hello Guys.
@Jonny: Oh I tried to use the OCX ina simpler project. Just drag n dropn the control, and process MouseMove to display X and Y values in textboxes. No loops. Still the same problem. The text boxes are updated only in the MouseClicks as opposed to MouseMoves.
@dglienna: My resolution is already 1024 x 768. I'll try with 800x600. Is the text in ur post
incomplete?
@WizBang: I have already tried commenting all the sub classing code. It does not matter.
I'll post the simpler app with a setup here.
Now after these conversations, I think it has do with something like exposing or calling events? Something like passing parameters????
Thanks.
-
1 Attachment(s)
Re: MouseUp in ActiveX - works in IDE but not in exe
hey Guys.
Here's the code. Please put SSubTmr6.dll in System32 and register with regsvr32.exe.
I have commented the subclassing code, it is in the class module. The commented subclassing code is bookmarked. I have also added the class module with subclassing uncommented, but outside project.
The app is as simple as it can get. It runs in IDE but not outside.
The code is not extensively commented, but mostly it is. And no algos for Reimann Hypothesis, just standard things are there inside.
Let's see what do we get now.
Thanks a lot.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
OK, the first thing I see is that the control doesn't have Option Explicit. This is always a good idea, and you can set the IDE to automatically add it to the top of every new module.
Well, there was a lot of scroll mouse stuff to comment out before it would run without flagging some problem. But once I got them all, it ran, and the MouseUp even fired both within the IDE and compiled. I did not include the dll or any other files. I just compiled the control directly into an exe.
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Quote:
Originally Posted by
WizBang
OK, the first thing I see is that the control doesn't have Option Explicit. This is always a good idea, and you can set the IDE to automatically add it to the top of every new module.
Well, there was a lot of scroll mouse stuff to comment out before it would run without flagging some problem. But once I got them all, it ran, and the MouseUp even fired both within the IDE and compiled. I did not include the dll or any other files. I just compiled the control directly into an exe.
OK if you already did it I can spare my time for other requests :D
But I cannot see it posted here. Dis you sent it to him by email ?
-
Re: MouseUp in ActiveX - works in IDE but not in exe
Hi Guys,
Sorry, I am being a bit late in reply, but was busy with something else.
But solved the problem (somehow ;) ), and though I should post something about it.
I found out the last version of the Control that was working perfectly.
Added the new features one by one, carefully avoiding the routes which I thought might have caused the problem.
After each new feature added, I checked if the control was working fine, and it was.
Finished the whole coding like that. The control just worked!!
So I solved it somehow, still can not pin-point where the problem was.
Thanks you all for your help and time. :)
And thanks to Subversion !!!!!!