Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:40:53+00:00 2026-06-17T15:40:53+00:00

I need to capture a printer driver’s settings that a windows machine has set

  • 0

I need to capture a printer driver’s settings that a windows machine has set up to determine if they have collate turned on for a particular printer.

I know how to get whether a printer can collate using the DeviceCapabilities call passing in DC_COLLATE but this does not tell me whether the print driver is set to collate or not, only that the printer has the ability to collate, not that it will collate.

Why?

I am trying to work around an issue in QuickReports with Delphi XE2 where our program no longer works the way it did when compiled under Delphi 6. With the Delphi 6 version no matter the settings from QuickReport it ALWAYS obeyed the collate setting in the printer driver. With the Delphi XE2 version it does not.

The user does not have security to change collate settings, it is forced on for them by their sysadmins and these documents need to print collated on the specified printer.

If I can determine if the driver is set to collate always I can just force the collate setting in QuickReport and it will do what I need and thus my question above.

As always I appreciate any ideas.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:40:54+00:00Added an answer on June 17, 2026 at 3:40 pm

    You need to use the Windows API functions OpenPrinter and GetPrinter. When calling GetPrinter, pass it a PRINTER_INFO_2 record, which will be returned with the pDevMode member set to a DEVMODE; that DEVMODE record contains a flag for whether collation is enabled (among other things).

    Here’s an old Borland NG post by TeamB’s Dr. Peter Below. It demonstrates updating printer settings to make them permanent, but it includes using OpenPrinter, GetPrinter, ClosePrinter, and PRINTER_INFO_2, as well as using the DEVMODE (referred to as hDevMode in the code below); it should get you started.

    Procedure MakePrintersettingsPermanent;
    var
      hPrinter: THandle;
      Device : array[0..255] of char;
      Driver : array[0..255] of char;
      Port   : array[0..255] of char;
      hDeviceMode: THandle;
      pDevMode: PDeviceMode;
      bytesNeeded: Cardinal;
      pPI: PPrinterInfo2;
      Defaults: TPrinterDefaults;
      retval: BOOL;
    begin
      Assert( Printer.PrinterIndex >= 0 );
      Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
      FillChar( Defaults, Sizeof(Defaults), 0 );
      Defaults.DesiredAccess:= 
        PRINTER_ACCESS_ADMINISTER or PRINTER_ACCESS_USE;
      if not WinSpool.OpenPrinter(@Device, hPrinter, @Defaults ) then
            RaiseLastWin32Error;
      try
        retval := WinSpool.GetPrinter(
          hPrinter,
          2,
          Nil, 0, @bytesNeeded );
        GetMem( pPI, bytesNeeded );
        try
          retval := WinSpool.GetPrinter(
            hPrinter, 2,
            pPI, bytesNeeded, @bytesNeeded );
          If not retval Then 
            RaiseLastWin32Error;
    
          pDevMode := GlobalLock( hDeviceMode );
          Assert( Assigned( pdevmode ));
          try
            Move( pdevmode^, pPI^.pDevMode^, Sizeof( pdevmode^ ));
          finally
            GlobalUnlock( hDevicemode );
          end;
          If not WinSpool.SetPrinter(
            hPrinter, 2,
            pPI,
            0 )
          Then
            RaiseLastWin32error;
        finally
          FreeMem( pPI );
        end;
      finally
        WinSpool.ClosePrinter( hPrinter );
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a need to capture signatures from an iOS app – the use
I need to capture the amount of time that ASP.net takes to execute each
I would like to be able to have a Printer installed on a windows
I need to capture particular windows of 3rd party process. I can find main
I have some HTML DOM elements for which I need to capture click events,
i have an iframe and need to capture the src attribute inside a javascript
$('input').change(function(){ alert($(this).val()); }); $('input').val(1); This dont work. I need capture the change input with
I need to capture right mouse click event inside a iframe in asp.net using
I need to capture keystokes from a wedge device and prevent any controls or
I need to capture either \d+\.\d+ or \d+ but nothing else. For instance ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.