“A call to Windows API CreateDC failed” – NiceLabel Error Message

Target Audience: Advanced User, IT Manager
Article #: 11655

Summary

The error message as it appears.

NiceLabel generates the error message “A call to Windows API function CreateDC failed.” while printing labels. This article offers a brief explanation of the cause and details how to fix the underlying problem to prevent future errors.

Explanation

NiceLabel uses the Windows functions known as programming calls. Also known as API calls, these are dynamic-linked libraries (DLLs) that are part of the Windows OS. APIs are used to perform tasks without having to write custom code.

In this case, NiceLabel communicates with the printer driver and queries the printer capabilities with the CreateCD function call.

The API call might fail when the label is created for one driver and you are printing it using another driver. In this case, the driver settings provided in DEVMODE structure from the current driver must be merged with settings from a new driver. Some printer drivers experience difficulties with the merge, causing the error.

Solution

There are several possible workarounds:

  • Make sure that you are using the latest available printer drivers.
  • Do not use the option Use printer properties saved in: Label. This option saves a copy of driver DEVMODE inside the label. The driver settings become part of the label. However, if you select another printer driver for printing, a merge of the current driver’s DEVMODE will happen with the DEVMODE from the selected driver. Some printer drivers have trouble with such a data merge and will create incorrect DEVMODE structure, resulting in the error.
    If this is the case, select Use printer properties saved in: Printer Driver. These two options are accessible in the Label Properties dialog box in NiceLabel Designer.
  • Create a label variant specific for the target printer. In this case, there is no merge of DEVMODE, as the DEVMODE already fits the target driver.
  • If you are using PCL5 printer drivers, try switching to PCL6 drivers.

As always, if you need further assistance, please contact us.

Author


Was this article helpful?