Results 1 to 3 of 3

Thread: subclassing and getting normal again

  1. #1

    Thread Starter
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694

    subclassing and getting normal again

    hi there !
    i want to subclass a listview in order to sort according to dates.

    i do something like this according to msdn:
    SendMessage lv_user.hWnd, LVM_SORTITEMS, lv_user.hWnd, AddressOf CompareDates

    where comparedates is a sub

    now the problem is
    that after i clear the listview and add new listitems
    they are not being displayed properly.

    is there a way to return to normal after subclassing.

    is this dangerous for crashes ?

    thanks !

  2. #2
    Addicted Member Abilio's Avatar
    Join Date
    May 2003
    Location
    Aveiro - Portugal
    Posts
    222
    I think you don't have a special need to send this kind of addressof. Why don't you only SendMessage, without addressof parameter ?

    If you really want to subclass, you should have some rules, like use Windows Database to store Long values, like:

    (Form_Load)

    SetProp listView.hwnd, "lpPROC", SetWindowLong(ListView.hwnd, GWL_WNDPROC, AddressOf ProcedureHOOK)

    and to unsubclass

    (Form_Unload)

    Dim RetVal As Long
    RetVal = SetWindowLong(ListView.hwnd, GWL_WNDPROC, GetProp(ListView.hwnd, "lpPROC"))
    RemoveProp ListView.hwnd, "lpPROC"

    This way, you never will crash because when you unsubclass, the real value will be passed. I bealive this will help you.

  3. #3

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