{"id":18,"date":"2009-09-17T20:32:21","date_gmt":"2009-09-18T01:32:21","guid":{"rendered":"http:\/\/anvil-of-time.com\/2009\/09\/17\/clearing-the-clipboard-in-powerbuilder\/"},"modified":"2021-03-08T10:22:18","modified_gmt":"2021-03-08T15:22:18","slug":"clearing-the-clipboard-in-powerbuilder","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/clearing-the-clipboard-in-powerbuilder\/","title":{"rendered":"PowerBuilder &#8211; Clearing the clipboard"},"content":{"rendered":"<p>Powerbuilder&#8217;s native &#8216;clipboard&#8217; method does not clear out the buffer.  Here is how to do it:<\/p>\n<pre name=\"code\" class=\"VB\">\/\/ external function declarations\nFunction boolean OpenClipboard ( &amp;\n\tulong hWndNewOwner &amp;\n\t) Library &quot;user32.dll&quot;\nFunction boolean EmptyClipboard ( &amp;\n\t) Library &quot;user32.dll&quot;\nFunction boolean CloseClipboard ( &amp;\n\t) Library &quot;user32.dll&quot;\n\/\/ code in application\nPowerObject lpo_parent\nULong lul_hWnd\n\/\/ loop thru parents until a window is found\nlpo_parent = This.GetParent()\nDo While lpo_parent.TypeOf() &lt;&gt; Window! and IsValid (lpo_parent)\n   lpo_parent = lpo_parent.GetParent()\nLoop\n\/\/ get handle to window\nlul_hWnd = Handle(lpo_parent)\n\/\/ clear the clipboard\nIf OpenClipboard(lul_hWnd) Then\n   EmptyClipboard()\n   CloseClipboard()\nElse \/\/ something else has the clipboard locked.\n   MessageBox(&quot;error&quot;,&quot;OpenClipboard Failed&quot;)\nEnd If<\/pre>\n\n\n<p>Updated March 2021 &#8211; not tested with newer PowerBuilder or Windows versions<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Powerbuilder&#8217;s native &#8216;clipboard&#8217; method does not clear out the buffer. Here is how to do it: \/\/ external function declarations Function boolean OpenClipboard ( &amp; ulong hWndNewOwner &amp; ) Library &quot;user32.dll&quot; Function boolean EmptyClipboard ( &amp; ) Library &quot;user32.dll&quot; Function boolean CloseClipboard ( &amp; ) Library &quot;user32.dll&quot; \/\/ code in application PowerObject lpo_parent ULong lul_hWnd&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[12],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/18"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":8,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":1717,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/18\/revisions\/1717"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}