[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Application running in background after closed in Vista

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
2 Answers

MikeD

11/10/2011 2:11:00 PM

0



"TW Scannell" <sidedriftergear@gmail.com> wrote in message
news:d3a2fbad-a5bf-46c8-95b1-1c8d2ad45673@k10g2000yqn.googlegroups.com...
> 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

So what's your question or problem you're encountering?

--
Mike


Thorsten Albers

11/10/2011 3:54:00 PM

0

TW Scannell <sidedriftergear@gmail.com> schrieb im Beitrag
<d3a2fbad-a5bf-46c8-95b1-1c8d2ad45673@k10g2000yqn.googlegroups.com>...
> printDlg.ShowPrinter (Me.hwnd)

First of all remove the parentheses:
printDlg.ShowPrinter (Me.hwnd)
->
printDlg.ShowPrinter Me.hwnd

Use parentheses in procedure calls only if really necessary or else they
may cause trouble.
Situations where to use parentheses:
Call MyProc(...)
... = MyProc(...)

--
Thorsten Albers

gudea at gmx.de