Skip to main content

This article explains why a dialog box presents in the background rather than foreground.

Problem:

PC_PRINTER_OPEN will display a dialog box allowing the user to choose a printer. In some circumstances the dialog box is displayed behind another window. Why is this, and can it be forced to the foreground?

Resolution:

The PC_PRINTER_OPEN accepts a handle (HWND) that is made the parent of the dialog box. The box can be forced to the front by using the GetForegroundWindow API call to retrieve HWND of the current window and passing that to the PC_PRINTER_OPEN routine.

Incident Number: 2353637

Old KB# 14573