Results 1 to 8 of 8

Thread: VB Studio closes by itself!

  1. #1

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    VB Studio closes by itself!



    If I exit my program VB Studio shuts down now. It will dfo this everytime Once I chose to close my application I developed. It never used to do that. If I run an older program and close it it works fine. Then I reopen my current application again and run things it is fine...until I try to debug anything it starts doing it again. Anybody seen that before?

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Studio closes by itself!

    Sounds like a sub-classing issue. That happens if you close the app without running thru the exit code of your app, which releases the hook.

  3. #3

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Re: VB Studio closes by itself!

    Yeah I have been removing my error handling so I can get right to the issue with any code right now. I have been doing that for years though.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Studio closes by itself!

    Post your project, or the sub-classing parts that hook and un-hook, and we'll see if there is anything that can be fixed. Does the IDE crash if you close the app correctly (rather than clicking on the X to close a form?)

  5. #5

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Re: VB Studio closes by itself!

    Here is some of the Code that uses subclassing to allow the Mouse Wheel to work in my grids.

    Code:
    Private Sub Form_Activate()
        FIRST_CLICK = True
        Call WheelHook(frmMDIChild_Service_Area_Detail)
    End Sub
    
    Private Sub Form_Deactivate()
        Call WheelUnHook
    End Sub
    
    Public Sub WheelHook(PassedForm As Form)
    
        On Error Resume Next
    
        Set myForm = PassedForm
        LocalHwnd = PassedForm.hwnd
        LocalPrevWndProc = SetWindowLong(LocalHwnd, GWL_WNDPROC, AddressOf WindowProc)
    End Sub
    
    Public Sub WheelUnHook()
        Dim WorkFlag As Long
    
        On Error Resume Next
        WorkFlag = SetWindowLong(LocalHwnd, GWL_WNDPROC, LocalPrevWndProc)
        Set myForm = Nothing
    End Sub

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Studio closes by itself!

    Take the error trap out of the unload, and place a breakpoint, to see if it's getting called. You may also want to put some code in the query unload of your form.

  7. #7

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Re: VB Studio closes by itself!

    You think I should have the UnHook function call in my Form_Unload Event instead?

  8. #8

    Thread Starter
    Fanatic Member Avatarp's Avatar
    Join Date
    Sep 2002
    Location
    Calgary
    Posts
    826

    Re: VB Studio closes by itself!

    I get an error "Object doesnt support this property or method" at this line:

    myForm.MouseWheel MouseKeys, Rotation, Xpos, Ypos



    Code:
    Private Function WindowProc(ByVal Lwnd As Long, ByVal Lmsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        Dim MouseKeys As Long
        Dim Rotation As Long
        Dim Xpos As Long
        Dim Ypos As Long
    
        If Lmsg = WM_MOUSEWHEEL Then
            MouseKeys = wParam And 65535
            Rotation = wParam / 65536
            Xpos = lParam And 65535
            Ypos = lParam / 65536
            myForm.MouseWheel MouseKeys, Rotation, Xpos, Ypos
        End If
        WindowProc = CallWindowProc(LocalPrevWndProc, Lwnd, Lmsg, wParam, lParam)
    End Function

Posting Permissions

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



Click Here to Expand Forum to Full Width