Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Device context handles and signed/unsigned integers

June 21, 2011

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 values in the entire unsigned 32-bit range.

However, since making the change in 7.25 we have done further research and found some inconsistencies in various programming environments.

In particular, the Windows SDK defines a device context handle HDC as a PVOID which is a signed 32-bit integer.

The .NET Framework uses System.IntPtr which is also a signed 32-bit integer.

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.

  • Delphi DCUs – Unsigned – Cardinal
  • Delphi DLL – Unsigned – HDC
  • C# ActiveX – Signed – System.IntPtr
  • C# DLL – Signed – System.IntPtr
  • C++ DLL – Signed – HDC
  • C++ ActiveX – Signed – HDC
  • VB.NET ActiveX – Signed – System.IntPtr
  • VB.NET DLL – Signed – System.IntPtr
  • PowerBuilder DLL – Signed -long
  • PowerBASIC DLL – Unsigned – DWORD
  • ActiveX Type Library – Signed – long

The information in this article supersedes the information that we posted on this topic a couple of weeks ago (specifically two two blog posts: Unsigned Integers and Device Context Functions and Unsigned Integers And Visual Basic).

Unsigned Integers and Device Context Functions

June 9, 2011

Update: the information in this post has been superseded by the information from this post: Device context handles and signed/unsigned integer.

In version 7.25 of Quick PDF Library we made a change to the API which made the use of unsigned integers necessary.

Unfortunately this change will break backwards compatibility for code that makes use of the RenderPageToDC, DARenderPageToDC, and GetCanvasDC functions — the only functions which use unsigned integers.

This means that for the RenderPageToDC and DARenderPageToDC functions the DC parameter now requires an unsigned integer to be passed to it and that the GetCanvasDC function now returns an unsigned integer. You will need to update your code to reflect this change prior to being able to successfully compile using version 7.25.

If you do not use any of these functions then you do not need to make any changes.

Most modern programming languages support unsigned integers, but there are a few older languages which do not. So for those languages we will attempt to come up with suitable workarounds — for example, as mentioned on this blog post a couple of days ago, we have created a TLB file to be used with the ActiveX edition of our library and VB6 which resolves the issue of VB6 not supporting unsigned integers. Leave a comment if your programming language does not support unsigned integers.

We do apologize in advance for any inconvenience that this break in backwards compatibility causes. We do our utmost to avoid situations like this but sometimes breaking backwards compatibility is necessary for the future health of the library.

Unsigned Integers And Visual Basic

June 7, 2011

Update: the information in this post has been superseded by the information from this post: Device context handles and signed/unsigned integer. It is no longer required to use unsigned integers with the ActiveX edition, this is handled internally by the library.

In version 7.25 of Quick PDF Library we made a change to the API which made the use of unsigned integers necessary. Unfortunately not all versions of programming languages support unsigned integers. In this particular case Visual Basic 6 and earlier versions do not support unsigned integers, while Visual Basic .NET and newer versions do.

Although VB6 was released over 10 years ago it still has a strong following and quite a few VB6 programmers use Quick PDF Library. This being the case we’ve come up with an easy workaround which will enable VB6 programmers to continue using all of the functions in Quick PDF Library.

We’re now providing a TLB file along with the ActiveX edition that handles the unsigned integers. The TLB file is only used at compile time so you won’t need to distribute it with your executable, but you will need to distribute the ActiveX as per usual.

The TLB file for Quick PDF Library 7.25 can be downloaded from here and will be included in all future installers.

Instructions for using the TLB file:

  1. Register the ActiveX on your machine as per usual
  2. Open your VB6 project
  3. Go to Project > References > Browse…
  4. Add the ‘QuickPDFAX0725VB.tlb’ file
  5. Compile

As you are adding the TLB file as the reference it is not necessary to add the ActiveX file as a project reference because the TLB file interfaces with the ActiveX through the registry.

Please note: if you do not use the GetCanvasDC, DARenderPageToDC or RenderPageToDC functions then you won’t run into any issues if you choose not to use the TLB file. The unsigned integers are currently only used with these functions.




© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum