{"id":36293,"date":"2005-03-03T07:00:00","date_gmt":"2005-03-03T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/03\/03\/the-bonus-window-bytes-at-gwlp_userdata\/"},"modified":"2005-03-03T07:00:00","modified_gmt":"2005-03-03T07:00:00","slug":"the-bonus-window-bytes-at-gwlp_userdata","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050303-00\/?p=36293","title":{"rendered":"The bonus window bytes at GWLP_USERDATA"},"content":{"rendered":"<p> The window manager provides a pointer-sized chunk of storage you can access via the <code>GWLP_USERDATA<\/code> constant. You pass it to <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/WindowClasses\/WindowClassReference\/WindowClassFunctions\/GetWindowLongPtr.asp\"> the <code>GetWindowLongPtr<\/code> function<\/a> and <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/WindowClasses\/WindowClassReference\/WindowClassFunctions\/SetWindowLongPtr.asp\"> the <code>SetWindowLongPtr<\/code> function<\/a> to read and write that value. Most of the time, all you need to attach to a window is a single pointer value anyway, so the free memory in <code>GWLP_USERDATA<\/code> is all you need. <\/p>\n<p> Note that this value, like the other window extra bytes and <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/12\/02\/55914.aspx\"> the messages in the <code>WM_USER<\/code> range<\/a>, belongs to the window class and not to the code that creates the window. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The window manager provides a pointer-sized chunk of storage you can access via the GWLP_USERDATA constant. You pass it to the GetWindowLongPtr function and the SetWindowLongPtr function to read and write that value. Most of the time, all you need to attach to a window is a single pointer value anyway, so the free memory [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-36293","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The window manager provides a pointer-sized chunk of storage you can access via the GWLP_USERDATA constant. You pass it to the GetWindowLongPtr function and the SetWindowLongPtr function to read and write that value. Most of the time, all you need to attach to a window is a single pointer value anyway, so the free memory [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=36293"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36293\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=36293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=36293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=36293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}