Choosing a printer wihout printing

Hello,
I am trying to create a printer selection window for my Desktop App, and in that window store the PrinterSetup.Settings in a file. It works but after I choose the printer, it prints and empty page.

I use this to choose the printer:

dim g as Graphics

ps = New PrinterSetup
call PrinterSetup.OpenPrinter(ps)

On Windows I use this declare to prevent a blank page.

if ps.pageSetupDialog then
   g= OpenPrinterDialog(ps)
   if g= nil then return false

   dim hdc as integer
   declare function AbortDoc lib "gdi32" (hDC as integer) as integer
  
   hdc= g.Handle(Graphics.HandleTypeHDC)
   call AbortDoc(hdc)
end

Don’t know about other platforms.

2 Likes

I’d consider that a bug.

3 Likes

I will try this. The problem is happening in Windows, thanks!