{"id":4013,"date":"2013-06-24T07:00:00","date_gmt":"2013-06-24T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/06\/24\/drawing-content-at-a-fixed-screen-position-regardless-of-window-position\/"},"modified":"2013-06-24T07:00:00","modified_gmt":"2013-06-24T07:00:00","slug":"drawing-content-at-a-fixed-screen-position-regardless-of-window-position","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20130624-00\/?p=4013","title":{"rendered":"Drawing content at a fixed screen position, regardless of window position"},"content":{"rendered":"<p><P>\nToday&#8217;s Little Program draws content at a fixed screen position.\nThe idea is that the window is really a viewport into some magical\nworld.\nUnfortunately, our magical world just has a sign that says\n&#8220;Booga booga.&#8221;\nCreating a more interesting magical world is left as an exercise.\n<\/P>\n<P>\nStart with our\n<A HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2003\/07\/23\/54576.aspx\">\nscratch program<\/A>\nand make these changes:\n<\/P>\n<PRE>\n<FONT COLOR=\"blue\">void OnMove(HWND hwnd, int x, int y)\n{\n InvalidateRect(hwnd, 0, TRUE);\n}<\/FONT><\/p>\n<p>void\nPaintContent(HWND hwnd, PAINTSTRUCT *pps)\n{\n <FONT COLOR=\"blue\">POINT ptOrigin = { 0, 0 };\n ClientToScreen(hwnd, &amp;ptOrigin);\n POINT ptOrg;\n SetWindowOrgEx(pps-&gt;hdc, ptOrigin.x, ptOrigin.y, &amp;ptOrg);\n TextOut(pps-&gt;hdc, 200, 200, TEXT(&#8220;Booga booga&#8221;), 11);\n SetWindowOrgEx(pps-&gt;hdc, ptOrg.x, ptOrg.y, nullptr);<\/FONT>\n}<\/p>\n<p><FONT COLOR=\"blue\">    HANDLE_MSG(hwnd, WM_MOVE, OnMove);<\/FONT>\n<\/PRE>\n<P>\nRun this program and drag the window across the screen.\nWhen it reaches the &#8220;magic place&#8221;,\nyou will see the words &#8220;Booga booga&#8221;.\n(You can resize the window to be smaller in order to make\nfinding the magic place more of a challenge.)\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s Little Program draws content at a fixed screen position. The idea is that the window is really a viewport into some magical world. Unfortunately, our magical world just has a sign that says &#8220;Booga booga.&#8221; Creating a more interesting magical world is left as an exercise. Start with our scratch program and make these [&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-4013","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Today&#8217;s Little Program draws content at a fixed screen position. The idea is that the window is really a viewport into some magical world. Unfortunately, our magical world just has a sign that says &#8220;Booga booga.&#8221; Creating a more interesting magical world is left as an exercise. Start with our scratch program and make these [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4013","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=4013"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4013\/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=4013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=4013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=4013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}