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

Thread: Gwlp_userdata

  1. #1
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Gwlp_userdata

    I have to call GetWindowLongPtr() with GWLP_USERDATA to redraw my tabcontrols.

    "Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero."

    What exactly is "user data associated with the window" ?

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Gwlp_userdata

    Quote Originally Posted by MasterDucky View Post
    What exactly is "user data associated with the window" ?
    It is exactly as you stated -- it is user data that is associated with a window.

    Say I wanted to have an some information to tag along with a window that is created. You would place that information into the GWLP_USERDATA section of the window object with SetWindowLongPtr() -- to retrieve the info you call GetWindowLongPtr().

    So GetWindowLongPtr() doesn't draw anything -- all it does is retrieve the information that was saved in the window object by whomever. So I don't know what that has to do with redrawing tab controls, unless the information needed to redraw the controls was saved there, you need to retrieve it, and do something else with this info that has to do with redrawing controls.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Re: Gwlp_userdata

    Thank you Paul,

    So userdata means what is typed in the window for example or the coordinates of the window?

    Regards

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Gwlp_userdata

    Quote Originally Posted by MasterDucky View Post
    Thank you Paul,

    So userdata means what is typed in the window for example or the coordinates of the window?

    Regards
    Possibly. Maybe what's stored there is a pointer to further information. Programmers routinely use this area to store a C++ object pointer so that they can associate a C++ object with a window. When the window's handler is called, to retrieve the object pointer, they just go to that area.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Gwlp_userdata

    Quote Originally Posted by MasterDucky View Post
    So userdata means what is typed in the window for example or the coordinates of the window?
    Userdata here means any data that programmer wants to attach to this tab. This may be a pointer to byte array, or string object, or predefined user structure instance, or user class object, whatever you want this to be. You may think of it like a locker where you put your valuable things (data) and leave those there until you need to reach to.
    Best regards,
    Igor

  6. #6
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Re: Gwlp_userdata

    Thanks 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
  •  





Click Here to Expand Forum to Full Width

Featured