TW Scannell
11/9/2011 12:26:00 AM
I have an application that has a t-Chart graph and uses the
PrinterDlg
In Vista, the program will continue to run if I call the ShowPrinter
Method with the windows handle
printDlg.ShowPrinter (Me.hwnd)
Calling with a 0 seems to fix it
printDlg.ShowPrinter 0
I have other forms that use the dialog and did not error until I added
the T-Chart Graph.
Pretty Voodo, black magic.
Dim printDlg As PrinterDlg
'Show Print Dialog and initialize printer:
Set printDlg = New PrinterDlg
printDlg.Orientation = vbPRORLandscape
printDlg.PrinterName = Printer.DeviceName
printDlg.ColorMode = Printer.ColorMode
printDlg.DriverName = Printer.DriverName
printDlg.Duplex = Printer.Duplex
printDlg.Port = Printer.Port
printDlg.PaperBin = Printer.PaperBin
printDlg.PaperSize = Printer.PaperSize
printDlg.PrintQuality = Printer.PrintQuality
printDlg.Flags = VBPrinterConstants.cdlPDNoSelection _
Or VBPrinterConstants.cdlPDNoPageNums _
Or VBPrinterConstants.cdlPDReturnDC
printDlg.CancelError = True
printDlg.Copies = 1
Printer.TrackDefault = False
On Error GoTo Done
'********************************
'Defect 441
If InStr(1, UCase(Tools.fncGetWindowsVersion), "VISTA") > 0
Then
printDlg.ShowPrinter 0 '<-- show printer dialog
Else
printDlg.ShowPrinter (Me.hwnd) '<-- show printer dialog
End If
'********************************
On Error GoTo ErrorHandle