Results 1 to 5 of 5

Thread: Subclassing...wheres my error?!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    IL, USA
    Posts
    5

    Arrow Subclassing...wheres my error?!

    Alright, I've made a program that uses several hotkeys. To do this, I implemented subclassing. When I exit the program, I get an error...

    I have the SetWindowLong() codes inside a form that is active the whole program, but the program starts with a Sub Main().

    The referenced procedure is in a module, as advised. Code is as follows:

    Code:
    Public Function CheckMessage(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        Select Case uMsg
            Case WM_HOTKEY
                HotKeyPress wParam
                CheckMessage = 1
                Exit Function
            Case Else
                CheckMessage = CallWindowProc(PrevProc, hWnd, uMsg, wParam, lParam)
        End Select
    End Function
    When I use the hotkey CTRL-SHIFT-F5 my program ends. As I unload the form I'm using in the module, the form initiates the code:

    SetWindowLong frmOptions.hWnd, GWL_WNDPROC, PrevProc

    And then the program ends.

    Any ideas where the error might be coming from?

    Thanks a bunch in advance,
    -Steve
    Last edited by iawix; Jan 27th, 2002 at 08:21 PM.
    iawix.com software...
    http://www.iawix.com/

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    IL, USA
    Posts
    5
    The debugging message I get in VC++ if I choose to debug is attached...
    Attached Images Attached Images  
    iawix.com software...
    http://www.iawix.com/

  3. #3
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    You need to unregister any hotkeys before the window that they are registered with terminates. Typically this is done in the WM_CLOSE message handler.

    HTH,
    Duncan
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    IL, USA
    Posts
    5
    thanks a lot, ill try it out when i get home!
    iawix.com software...
    http://www.iawix.com/

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    IL, USA
    Posts
    5
    I was registering the same function keys as hotkeys, but with different key combinations. I had functions for one set of keys when CTRL only was down, and another set for when CRTL + SHIFT was pressed down. I got rid of this and the error dissapeared.

    Seems sort of asinine to me
    iawix.com software...
    http://www.iawix.com/

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