Thread: Subclassing a dialog->Calling DialogProc

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Subclassing a dialog->Calling DialogProc

    When I'm subclassing a window created with CreateWindow, i call the WindowProc with CallWindowProc().
    I can't seem to find a similar function for dialogs(MsVC).

    Is this done in another way in dialogs? I tried to search the board, but found nothing of interest.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    A dialog is just a window that is ultimately created by a call to CreateWindowEx so CallWindowProc should be fine for default message processing.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    But when i try to call dialogproc, i get a message saying that it's not the right parameter type.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Then cast it. From winuser.h (oct2002psdk):
    Code:
    typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
    
    typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
    (the INT_PTR return type for dlgproc was previously BOOL).

    And from basetsd.h:
    The INT_PTR is guaranteed to be the same size as a pointer.
    ie on 32bit systems its a 32bit value ie the same as LRESULT.

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Yes.
    That's the thing to do. I think I'll have to start thinking before i ask...
    Thank you

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    LRESULT in the new SDK headers is a typedef for INT_PTR too, as is LPARAM. WPARAM is a typedef for UINT_PTR.

    It really gets old now...
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Originally posted by CornedBee
    LRESULT in the new SDK headers is a typedef for INT_PTR too, as is LPARAM. WPARAM is a typedef for UINT_PTR.

    It really gets old now...
    Where would that be then? From windef.h (oct2002psdk):
    Code:
    typedef UINT_PTR            WPARAM;
    typedef LONG_PTR            LPARAM;
    typedef LONG_PTR            LRESULT;

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    LONG_PTR, INT_PTR, they are the same.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Edit controls of a dialog from another dialog...
    By Snake in forum Windows Programming
    Replies: 9
    Last Post: 07-01-2005, 02:18 PM
  3. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  4. Getting the position of a dialog without parent on the screen
    By stormbringer in forum Windows Programming
    Replies: 1
    Last Post: 08-27-2003, 02:59 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM