[RESOLVED] MouseUp in ActiveX - works in IDE but not in exe - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38

Thread: [RESOLVED] MouseUp in ActiveX - works in IDE but not in exe

  1. #16
    Join Date
    Mar 2009
    Posts
    19

    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.

  2. #17
    Join Date
    Mar 2009
    Posts
    19

    Question 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.

  3. #18
    Join Date
    Dec 2001
    Posts
    6,332

    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.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  4. #19
    Join Date
    Mar 2009
    Posts
    19

    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.

  5. #20
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,722

    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()???

  6. #21
    Join Date
    Dec 2001
    Posts
    6,332

    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?
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  7. #22
    Join Date
    Mar 2009
    Posts
    19

    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.

  8. #23
    Join Date
    Mar 2009
    Posts
    19

    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.

  9. #24
    Join Date
    Mar 2009
    Posts
    19

    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?

  10. #25
    Join Date
    Dec 2001
    Posts
    6,332

    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.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  11. #26
    Join Date
    Dec 2001
    Posts
    6,332

    Re: MouseUp in ActiveX - works in IDE but not in exe

    Quote Originally Posted by AlexanderSupertramp View Post
    @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.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  12. #27
    Join Date
    Dec 2001
    Posts
    6,332

    Re: MouseUp in ActiveX - works in IDE but not in exe

    Quote Originally Posted by AlexanderSupertramp View Post
    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.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  13. #28
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,537

    Re: MouseUp in ActiveX - works in IDE but not in exe

    Quote Originally Posted by WoF View Post
    @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.
    Last edited by JonnyPoet; March 13th, 2009 at 04:39 PM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  14. #29
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,537

    Re: MouseUp in ActiveX - works in IDE but not in exe

    Quote Originally Posted by AlexanderSupertramp View Post
    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
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  15. #30
    Join Date
    Mar 2009
    Posts
    19

    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?

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center