PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED] scroll MDI Container with mouse wheel???-VBForums
Results 1 to 35 of 35

Thread: [RESOLVED] scroll MDI Container with mouse wheel???

  1. #1

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Resolved [RESOLVED] scroll MDI Container with mouse wheel???

    Ok so here's the situation. I have a mdi container with a child form inside of it. The child forms is longer than the mdi container which creates a vertical scroll bar.

    Is there any way to scroll the mdi container with the mouse wheel. So far I cannot get it working. I want to be able to scroll it with the mouse wheel, not just manually (point, click, drag). Any ideas??

    Thanks guys! Any help would be appreciated!
    Last edited by adamm83; Jul 5th, 2006 at 01:06 PM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  2. #2

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    can anyone help?
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,422

    Re: scroll MDI Container with mouse wheel???

    Im not sure if this works with a child Form, but you can try, take a look at This thread in the codebank by Bushmobile

  4. #4

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    thanks jcis!

    I will check it out!


    EDIT:
    If anyone else has any other ideas, please post. I do not think the script that jcis linked to will work with MDI child and parent forms.
    Last edited by adamm83; Jul 5th, 2006 at 03:49 PM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    I've decided to post this here (rather than the codebank thread) so more people will see it and possibly come up with a solution to another problem that gets generated.

    It seems that as long as the ActiveControl isn't one which already responds to the mousewheel (textbox/combobox/etc.) then the WM_MOUSEWHEEL is sent to the MDIForm and we just have to do some simple subclassing and then we can move the child form accordingly.

    However - the MDIForm scrollbar won't change it's position relative to the movement of the form - and I can't, for the life of me, get it to refresh without resorting to resizing the whole MDIForm which is obvious to the user.

    Anyway - here's the code:
    VB Code:
    1. ' In MDIForm
    2. Option Explicit
    3.  
    4. Private Sub MDIForm_Load()
    5.     Call WheelHook(Me.hwnd)
    6. End Sub
    7.  
    8. Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, ByVal Xpos As Long, ByVal Ypos As Long)
    9.     Const lScrollAmount As Long = 180
    10.     With Me.ActiveForm
    11.         If Rotation > 0 Then
    12.             If .Top < 0 Then .Top = .Top + lScrollAmount
    13.             If .Top > 0 Then .Top = 0
    14.         Else
    15.             If .Top + .Height > Me.ScaleHeight Then .Top = .Top - lScrollAmount
    16.             If .Top + .Height < Me.ScaleHeight Then .Top = Me.ScaleHeight - .Height
    17.         End If
    18.         ' Refresh the scrollbar here - but how???????????
    19.     End With
    20. End Sub
    21.  
    22. Private Sub MDIForm_Unload(Cancel As Integer)
    23.     Call WheelUnHook(Me.hwnd)
    24. End Sub
    25.  
    26.  
    27. ' In Module
    28. Option Explicit
    29.  
    30. Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
    31.     ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    32.  
    33. Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
    34.     ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    35.  
    36. Private Const GWL_WNDPROC = -4
    37. Private Const WM_MOUSEWHEEL = &H20A
    38.  
    39. Private lPrevProc As Long
    40.  
    41. ' Check Messages
    42. ' ================================================
    43. Private Function WindowProc(ByVal Lwnd As Long, ByVal Lmsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    44.     Dim MouseKeys As Long, Rotation As Long, Xpos As Long, Ypos As Long
    45.    
    46.     Select Case Lmsg
    47.         Case WM_MOUSEWHEEL
    48.           MouseKeys = wParam And 65535
    49.           Rotation = wParam / 65536
    50.           Xpos = lParam And 65535
    51.           Ypos = lParam / 65536
    52.          
    53.           MDIForm1.MouseWheel MouseKeys, Rotation, Xpos, Ypos
    54.     End Select
    55.    
    56.     WindowProc = CallWindowProc(lPrevProc, Lwnd, Lmsg, wParam, lParam)
    57. End Function
    58.  
    59. ' Hook / UnHook
    60. ' ================================================
    61. Public Sub WheelHook(ByVal hwnd As Long)
    62.   On Error Resume Next
    63.   lPrevProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc)
    64. End Sub
    65.  
    66. Public Sub WheelUnHook(ByVal hwnd As Long)
    67.   On Error Resume Next
    68.   SetWindowLong hwnd, GWL_WNDPROC, lPrevProc
    69. End Sub

    Edit: Just incase you weren't aware - this code (since it uses subclassing) will crash the IDE and you'll lose any unsaved work if you press the Stop button - unload the form correctly and you'll have no trouble & remember to save!

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,312

    Re: scroll MDI Container with mouse wheel???

    i have used subclassing code to scoll a frame and that works correctly, but have not tried it on an mdi form,

    on my computer i use either intellimouse, or freewheel, as they allow me to scroll all the windows in vb ide and some other programs that don't support scroll wheel.

    i just tested freewheel on an mdi form and it works correctly

    intellimouse (from microsoft) must be versions 4 (not later), also this clashes with touchpad drivers on my notebook

    freewheel works fine on my notebook and is available free

    pete

    i have just tested the mousewheel code in a mdi form and it seems to work ok, but i have no idea what the difference is, so here it is courtesy of MS.
    i took out the code to move the vertical scroll bar i had for the frame

    in the child form

    VB Code:
    1. Private Sub Form_Load()
    2. WheelHook Me
    3. End Sub
    4.  
    5.  
    6. Private Sub Form_Unload(Cancel As Integer)
    7. WheelUnHook
    8. End Sub

    in the module

    VB Code:
    1. Private Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" ( _
    2. ByVal lpPrevWndFunc As Long, _
    3. ByVal hWnd As Long, _
    4. ByVal Msg As Long, _
    5. ByVal Wparam As Long, _
    6. ByVal Lparam As Long) As Long
    7.  
    8. Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" ( _
    9. ByVal hWnd As Long, _
    10. ByVal nIndex As Long, _
    11. ByVal dwNewLong As Long) As Long
    12.  
    13. Public Const MK_CONTROL = &H8
    14. Public Const MK_LBUTTON = &H1
    15. Public Const MK_RBUTTON = &H2
    16. Public Const MK_MBUTTON = &H10
    17. Public Const MK_SHIFT = &H4
    18. Private Const GWL_WNDPROC = -4
    19. Private Const WM_MOUSEWHEEL = &H20A
    20.  
    21. Dim LocalHwnd As Long
    22. Dim LocalPrevWndProc As Long
    23. Dim MyForm As Form
    24.  
    25.  
    26. Private Function WindowProc(ByVal Lwnd As Long, ByVal Lmsg As Long, ByVal Wparam As Long, ByVal Lparam As Long) As Long
    27.  
    28.     Dim MouseKeys As Long
    29.     Dim Rotation As Long
    30.     Dim Xpos As Long
    31.     Dim Ypos As Long
    32.  
    33.     If Lmsg = WM_MOUSEWHEEL Then
    34.         MouseKeys = Wparam And 65535
    35.         Rotation = Wparam / 65536
    36.         Xpos = Lparam And 65535
    37.         Ypos = Lparam / 65536
    38. '        MyForm.mousewheel MouseKeys, Rotation, Xpos, Ypos  'code on form to move scroll bar, not required for mdi form
    39.     End If
    40.     WindowProc = CallWindowProc(LocalPrevWndProc, Lwnd, Lmsg, Wparam, Lparam)
    41. End Function
    42.  
    43. Public Sub WheelHook(PassedForm As Form)
    44.  
    45.     On Error Resume Next
    46.  
    47.     Set MyForm = PassedForm
    48.     LocalHwnd = PassedForm.hWnd
    49.     LocalPrevWndProc = SetWindowLong(LocalHwnd, GWL_WNDPROC, AddressOf WindowProc)
    50. End Sub
    51.  
    52.  
    53. Public Sub WheelUnHook()
    54.     Dim WorkFlag As Long
    55.  
    56.     On Error Resume Next
    57.     WorkFlag = SetWindowLong(LocalHwnd, GWL_WNDPROC, LocalPrevWndProc)
    58.     Set MyForm = Nothing
    59. End Sub
    Last edited by westconn1; Jul 6th, 2006 at 04:00 AM.

  7. #7

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by bushmobile
    I've decided to post this here (rather than the codebank thread) so more people will see it and possibly come up with a solution to another problem that gets generated.

    It seems that as long as the ActiveControl isn't one which already responds to the mousewheel (textbox/combobox/etc.) then the WM_MOUSEWHEEL is sent to the MDIForm and we just have to do some simple subclassing and then we can move the child form accordingly.

    However - the MDIForm scrollbar won't change it's position relative to the movement of the form - and I can't, for the life of me, get it to refresh without resorting to resizing the whole MDIForm which is obvious to the user.

    Edit: Just incase you weren't aware - this code (since it uses subclassing) will crash the IDE and you'll lose any unsaved work if you press the Stop button - unload the form correctly and you'll have no trouble & remember to save!
    Hey bushmobile,

    I just tested out your code and it works!!! The vertical scrollbar DOES refresh, but only when you move your mouse outside the mdi form. Also, one thing I noticed is it scrolls the child even if it's smaller than the parent. What I mean is, even if there is no vertical scrollbar, it still scrolls the child, which is not necessary.

    I will take a look at the code and see what I can do with it. I will also try out the FreeWheel and/or MS Intellipoint app that westconn1 suggested. I would honestly rather install a small mouse driver to fix the problem rather than add some code that may or may not cause other conflicts with my application.

    Again i will test both ways and see which works better. Although I am not sure if westconn1 understands what I was looking for. I don't need to be able to scroll in the vb IDE. There is actually a fix from microsoft to fix the vb6 IDE scroll wheel problem here, which also suggests to install Intellipoint v4.12. But I will try intellipoint and freewheel to see if it works with scrolling an mdi parent and child form.

    EDIT:
    hahaha I figured out a SUPER ghetto way of refreshing the scrollbar. Actually it's stupid and pointless, but maybe it will get you thinking...
    Add this where your comments is:
    VB Code:
    1. Me.Visible = False
    2. Me.Visible = True

    Maybe its just a matter of setting a property of the mdi form which whill initiate a refresh.
    Last edited by adamm83; Jul 6th, 2006 at 03:25 PM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  8. #8
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by adamm83
    Also, one thing I noticed is it scrolls the child even if it's smaller than the parent. What I mean is, even if there is no vertical scrollbar, it still scrolls the child, which is not necessary.
    add this line:
    VB Code:
    1. With Me.ActiveForm
    2.         [B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
    3.         If Rotation > 0 Then
    Quote Originally Posted by adamm83
    I will take a look at the code and see what I can do with it. I will also try out the FreeWheel and/or MS Intellipoint app that westconn1 suggested. I would honestly rather install a small mouse driver to fix the problem rather than add some code that may or may not cause other conflicts with my application.
    if you aim to distribute your app then this isn't really an option - if it's just for yourself then getting a new driver would be the easier thing to do.

  9. #9

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    ok so I tested out IntelliPoint and FreeWheel and neither of them accomplish what your code can do. Neither of them can scroll the mdi container.

    Quote Originally Posted by bushmobile
    add this line:
    VB Code:
    1. With Me.ActiveForm
    2.         [B]If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub[/B]
    3.         If Rotation > 0 Then
    if you aim to distribute your app then this isn't really an option - if it's just for yourself then getting a new driver would be the easier thing to do.
    Thanks, that fixed the problem. Figured out the refresh yet? I'm sure there is some sort of API or code that will force refresh a form. I will see what else I can do to refresh.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  10. #10
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    Quote Originally Posted by adamm83
    Figured out the refresh yet? I'm sure there is some sort of API or code that will force refresh a form. I will see what else I can do to refresh.
    I tried almost everything I could think of and nothing worked. this was the best I could come up with:
    VB Code:
    1. ' In declarations
    2. Private Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
    3.  
    4. ' in the place where we want the refresh
    5. LockWindowUpdate Me.hWnd
    6. Me.Height = Me.Height + 15
    7. Me.Height = Me.Height - 15
    8. LockWindowUpdate False
    Since we're changing the size of the window the entire desktop will be redrawn (the icons will flicker like crazy)

  11. #11

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    hmmm ... wierd. I tried that before, and it didn't work for me. I'll try it again. what does LockWindowUpdate do?

    EDIT:

    Ok I tried it out and it works!... I also tried removing the 2 LockWindowUpdate lines and it works as well.... without the icon flickering. So I'm not sure what LockWindowUpdate does, but it seems to work without it.
    Last edited by adamm83; Jul 7th, 2006 at 06:28 AM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  12. #12

  13. #13

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    see my edit above ^^^
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  14. #14
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    if you don't use LockWindowUpdate then you can see the form changing size. here's a working example:

    Attached Files Attached Files

  15. #15
    Lively Member Agilaz's Avatar
    Join Date
    Jun 2006
    Posts
    98

    Re: scroll MDI Container with mouse wheel???

    VB Code:
    1. Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, ByVal Xpos As Long, ByVal Ypos As Long)
    2.     Dim hwndMDI As Long
    3.     Const lScrollAmount As Long = 180
    4.    
    5.     With Me.ActiveForm
    6.         If .Top >= 0 And .Height < Me.ScaleHeight Then Exit Sub
    7.         If Rotation > 0 Then
    8.             If .Top < 0 Then .Top = .Top + lScrollAmount
    9.             If .Top > 0 Then .Top = 0
    10.         Else
    11.             If .Top + .Height > Me.ScaleHeight Then .Top = .Top - lScrollAmount
    12.             If .Top + .Height < Me.ScaleHeight Then .Top = Me.ScaleHeight - .Height
    13.         End If
    14.  
    15.     End With
    16.     hwndMDI = FindWindowEx(Me.hwnd, 0, "MDIClient", vbNullString)
    17.     If hwndMDI <> 0 Then
    18.         ShowWindow hwndMDI, 0
    19.         ShowWindow hwndMDI, 1
    20.     End If
    21. End Sub

    you need to enforce a MDIClient window update. i used showwindow but other APIs might work as well (movewindow?).

    EDIT:

    ok, this one doesn't make sense but it works

    VB Code:
    1. Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
    2. Private Const SB_HORZ = 0
    3. Private Const SB_VERT = 1
    4. Private Const SB_BOTH = 3
    5. ...
    6.  
    7. Public Sub MouseWheel(ByVal MouseKeys As Long, ByVal Rotation As Long, ByVal Xpos As Long, ByVal Ypos As Long)
    8. ...
    9.     hwndMDI = FindWindowEx(Me.hwnd, 0, "MDIClient", vbNullString)
    10.     If hwndMDI <> 0 Then
    11.         ShowScrollBar hwndMDI, SB_VERT, False
    12.     End If
    13. ...

    it's supposed to hide the scrollbar but it only gets updated.
    Last edited by Agilaz; Jul 7th, 2006 at 09:08 AM.

  16. #16

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    agilaz, where is the declaration for FindWindowEx and ShowScrollbar and the var for hwndMDI??
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  17. #17
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    @Agilaz: good stuff - i think it became a case of "can't see the wood for the trees" for me.

    @adamm83: Look them up at AllAPI.net

  18. #18

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    thanks... AllAPI is a nice resource!!!

    But what do I declare hwndMDI as?

    Dim hwndMDI As ????
    Last edited by adamm83; Jul 7th, 2006 at 10:50 AM.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  19. #19
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    You'll see from the declaration that FindWindowEx returns a Long, so...

  20. #20

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    ah

    thanks.. have a ducky
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  21. #21

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    GREAT! I integrated it into my application and it works like a charm!!!

    Thanks bushmobile AND aliganz!!! I appreciate all the time and help you offered!!!

    Quick question though... how do I change the speed it scrolls, or rather the amount it scrolls?
    EDIT:
    NVM.. figured it out... I didn't open my eyes wide enough
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  22. #22
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    No Probs

    Don't forget to mark this thread resolved using the thread tools just above your first post

  23. #23

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    ok problem.

    I get an Error 91: Object variable or With block not set when I try to scroll while there is no child in the mdi parent.

    I assume this is because it's trying to access the position of a child form which does not exist. How can I avoid this?
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  24. #24
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: scroll MDI Container with mouse wheel???

    VB Code:
    1. Const lScrollAmount As Long = 180
    2.     If Me.ActiveForm Is Nothing Then Exit Sub
    3.     With Me.ActiveForm

  25. #25

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: scroll MDI Container with mouse wheel???

    perfect! I'm a happy camper!
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  26. #26
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    May I suggest a minor mod:-

    VB Code:
    1. With Me.ActiveForm
    2.     If .Top >= 0 And [COLOR=Red](.Top +[/COLOR] .Height[COLOR=Red])[/COLOR] < Me.ScaleHeight Then Exit Sub
    3.     If Rotation > 0 Then

  27. #27

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    crap i thought everything was working, but i notice now that when I exit my app using the close button on the toolbar controls (the x at the top right coner), it seems to crash (without any errors).

    What would cause this?? I realize it could be any number of things, but my app is very large. I use the MDIForm's QueryUnload routine when shutting down my app, could this be the problem?
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  28. #28
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    what code are you using to close the form?

    Are you using End anywhere? If so, don't - use Unload Me

  29. #29

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    I have several forms, not just an mdiform... I unload each manually (unload FormName).

    Problem is that once I unload all my forms, there is still something running from my program, so I use End after I unload all my forms. How can I find out what residue is left behind from my app ??? so that I don't have to use End...
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  30. #30
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    Quote Originally Posted by adamm83
    I have several forms, not just an mdiform... I unload each manually (unload FormName).

    Problem is that once I unload all my forms, there is still something running from my program, so I use End after I unload all my forms. How can I find out what residue is left behind from my app ??? so that I don't have to use End...
    You probably still have a form that hasn't been unloaded, or something that hasn't been closed, or an object that hasn't been set to nothing... without seeing your project its impossible to say what.

    & just to double check - have you definitely got Call WheelUnHook(Me.hwnd) in the MDIForm_Unload event

  31. #31

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    yes I tried placing it in MDIForm_Unload, MDIForm_QueryUnload as well as the my sub routine that unloads all the forms.

    My app did not crash when closing until I load/unload the WheelUnHook.

    I know this doesn't relate to the topic but is there any way I trace what is left behind? like another program?
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  32. #32
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    as soon as you start subclassing doing certain things wrong that your program would have coped with previously can crash your program - without seeing the code it's hard to help you - perhaps upload your project.

  33. #33

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    ahahha not a chance, it's a huge program and would not be worth your time to go through it all. I think I will just try and see what I can do on my own.

    Do you know of any third aprty apps that would help debug my code to see whats going on?
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

  34. #34
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    you should know what you're using and therefore you should know what you need to close/destroy.

    I'm not aware of any 3rd party apps - search the forum - you may find some more info.

  35. #35

    Thread Starter
    Addicted Member adamm83's Avatar
    Join Date
    Oct 2005
    Location
    Toronto, ON, Canada
    Posts
    180

    Re: [RESOLVED] scroll MDI Container with mouse wheel???

    I do know exactly what I'm using, but its hard to track everything in my app as it is a lot of code.
    adamm
    ACM Designs

    Codebank:
    RegOpen - Open registry keys in Regedit quick & easily


    "A man who tries to catch two rabbits at the same time will catch neither."

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width