Subclassing a button
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Subclassing a button

  1. #1
    Join Date
    Sep 2010
    Posts
    13

    Subclassing a button

    I uploaded the Main.cpp. I tried to subclass a button but after
    Code:
    OldButtonProcedure = (WNDPROC)SetWindowLongPtr(hButton, GWLP_WNDPROC, (LONG_PTR)ButtonProcedure);
    the button dissapears. What is wrong ?
    Last edited by Sevko; November 2nd, 2011 at 05:53 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Smile Re: Subclassing a button

    Replace:
    Code:
                return OldButtonProcedure(hwnd, message, wParam, lParam);
    with:
    Code:
               return CallWindowProc(OldButtonProcedure, hwnd, message, wParam, lParam);
    Maybe, also:
    Code:
                OldButtonProcedure = (WNDPROC)SetWindowLongPtr(hButton, GWLP_WNDPROC, (LONG_PTR)ButtonProcedure);
    with:
    Code:
                OldButtonProcedure = (WNDPROC)SetWindowLong(hButton, GWL_WNDPROC, (LPARAM)ButtonProcedure);

  3. #3
    Join Date
    Sep 2010
    Posts
    13

    Re: Subclassing a button

    Thanks it works now, but I found out about BCM_SETIMAGELIST so the whole mouse track to change buttons on hover was a bad idea. If any 1 happens to know how to use ImageList_Create and Add without: [Linker error] undefined reference to `ImageList_Create@20'. Please let me know in this post. Otherwise I'll probably post a new thread in a couple of days.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,990

    Re: Subclassing a button

    ImageList_Create

    Header
    Commctrl.h

    Library
    Comctl32.lib
    Does this ring any bells?
    Best regards,
    Igor

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center