{"id":548,"date":"2011-06-21T08:01:00","date_gmt":"2011-06-21T15:01:00","guid":{"rendered":"http:\/\/www.quickpdflibrary.com\/blog\/?p=548"},"modified":"2011-06-21T08:01:00","modified_gmt":"2011-06-21T15:01:00","slug":"device-context-handles-and-signedunsigned-integers","status":"publish","type":"post","link":"https:\/\/www.quickpdflibrary.com\/blog\/2011\/06\/device-context-handles-and-signedunsigned-integers\/","title":{"rendered":"Device context handles and signed\/unsigned integers"},"content":{"rendered":"<p>For Quick PDF Library version 7.25 we changed the integer type of the device context handles returned by the <strong>GetCanvasDC<\/strong> function and accepted as parameters to the <strong>RenderPageToDC <\/strong>and <strong>DARenderPageToDC <\/strong>functions.<\/p>\n<p>The reason for this is that the Delphi VCL declares the <strong>HDC <\/strong>type as an unsigned 32-bit integer.<\/p>\n<p>The Windows graphics system does return values in the entire unsigned 32-bit range.<\/p>\n<p>However, since making the change in 7.25 we have done further research and found some inconsistencies in various programming environments.<\/p>\n<p>In particular, the Windows SDK defines a device context handle <strong>HDC <\/strong>as a <strong>PVOID <\/strong>which is a signed 32-bit integer.<\/p>\n<p>The .NET Framework uses <strong>System.IntPtr<\/strong> which is also a signed 32-bit integer.<\/p>\n<p>For 7.26 we will be making further changes to how device context handles are processed by Quick PDF Library to properly match different programming languages.<\/p>\n<ul>\n<li><strong>Delphi DCUs<\/strong> &#8211; Unsigned &#8211; Cardinal<\/li>\n<li><strong>Delphi DLL<\/strong> &#8211; Unsigned &#8211; HDC<\/li>\n<li><strong>C# ActiveX<\/strong> &#8211; Signed &#8211; System.IntPtr<\/li>\n<li><strong>C# DLL<\/strong> &#8211; Signed &#8211; System.IntPtr<\/li>\n<li><strong>C++ DLL<\/strong> &#8211; Signed &#8211; HDC<\/li>\n<li><strong>C++ ActiveX<\/strong> &#8211; Signed &#8211; HDC<\/li>\n<li><strong>VB.NET ActiveX<\/strong> &#8211; Signed &#8211; System.IntPtr<\/li>\n<li><strong>VB.NET DLL<\/strong> &#8211; Signed &#8211; System.IntPtr<\/li>\n<li><strong>PowerBuilder DLL<\/strong> &#8211; Signed -long<\/li>\n<li><strong>PowerBASIC DLL<\/strong> &#8211; Unsigned &#8211; DWORD<\/li>\n<li><strong>ActiveX Type Library<\/strong> &#8211; Signed &#8211; long<\/li>\n<\/ul>\n<p>The information in this article\u00a0supersedes\u00a0the information that we posted on this topic a couple of weeks ago (specifically two two blog posts:\u00a0<a href=\"http:\/\/www.quickpdflibrary.com\/blog\/2011\/06\/unsigned-integers-and-device-context-functions\/\">Unsigned Integers and Device Context Functions<\/a> and\u00a0<a href=\"http:\/\/www.quickpdflibrary.com\/blog\/2011\/06\/unsigned-integers-and-visual-basic\/\">Unsigned Integers And Visual Basic<\/a>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For Quick PDF Library version 7.25 we changed the integer type of the device context handles returned by the GetCanvasDC function and accepted as parameters to the RenderPageToDC and DARenderPageToDC functions. The reason for this is that the Delphi VCL declares the HDC type as an unsigned 32-bit integer. The Windows graphics system does return [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8,6],"tags":[206,194,197,193,204,205,195,203,191],"class_list":["post-548","post","type-post","status-publish","format-standard","hentry","category-news","category-quick-pdf-library","category-tips-and-tutorials","tag-32-bt-integer","tag-darenderpagetodc","tag-device-context","tag-getcanvasdc","tag-hdc","tag-pvoid","tag-renderpagetodc","tag-signed-integers","tag-unsigned-integers"],"_links":{"self":[{"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/posts\/548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/comments?post=548"}],"version-history":[{"count":5,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/posts\/548\/revisions"}],"predecessor-version":[{"id":554,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/posts\/548\/revisions\/554"}],"wp:attachment":[{"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/media?parent=548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/categories?post=548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickpdflibrary.com\/blog\/wp-json\/wp\/v2\/tags?post=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}