You can use the Vbprndlg.dll file instead of the
??????? ????dialog box portion of the Visual Basic
CommonDialog???????? ??? This file exposes properties and provides functionality
that the
CommonDialogcontrol does not.
The
CommonDialogcontrol in Visual Basic permits the
??????? ????dialog box to be displayed, but it does not give access to many
of the properties that can be set in the
??????? ????????? ????? ?????? consumed ??
??????????????? ??? ?????? ???????? ?????? ?? ???? (??????, ????-??????? ??????) Win32 ????????? ???????????? ??????? (API) ?????? ?? Visual Basic ?? ??? ?? ???, ?? ?? reliably ??????? ???? ?? ???? ???????? ??????? ?? API ??? ?? ????? ????? ???? ?????? ?? ??? ??? ?? ???? ?????? ?? ???? ????? ?? ???? ??? ?? ?? DLL
??????????
CommonDialog???????? ???
???????? ?? ??????? ????
????? ????? Microsoft ??????? ?????? ?? ??????? ?? ??? ?????? ??::
Vbprndlg.exe
(http://download.microsoft.com/download//vb60pro/Utility/1.0/WIN98MeXP/EN-US/Vbprndlg.exe)
?????? ??????: ???-30-2002
Microsoft ?????? ??????? ?? ???? ??????? ???? ?? ???? ??? ???? ????? ?? ???, ????? ???? ?????? ?? ????? ?? ???? ?? Microsoft ???????? ??? ?????::
119591
(http://support.microsoft.com/kb/119591/EN-US/
)
?????? ?????? ?? Microsoft ?????? ??????? ???? ??????? ????
Microsoft ????? ?? ??? ?? ????? ?? ????? ?? ??? Microsoft ?? ?? ?????? ?? ?????? ???? ??????? ?????-??? ?????????? ?? ????? ???? ?? ????? ????? ?? ?? ??.. ????? ?? ?? ???????-??????????? ????? ?? ???????? ???? ??? ?? ?? ????? ??? ???? ?? ??????? ???????? ?? ????? ??? ??? ???? ??..Vbprndlg.exe ????? ??? ????? ?????? ???:
?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
| ????? ??? | ???? |
|---|
| Vbprndlg.dll | 100.0 KB |
| Vbprndlg.exp | 1.0 KB |
| Vbprndlg.lib | 1.72 KB |
| Vbprndlg.DEP | 118 ?????? |
| Readme.txt | 10.9 KB |
Vbprndlg.exe ??????? ????
- ???? ????? ?? ???? ????? ????? ?? ??????? ?? ???????, ?? ?? ?? ?????? ?? ??? ?? ?????? ?? ??????? Windows ?? ??????? System32 ?????????? ?? Winnt ?????????? ??? ?????????? ?? ??? ????
- ????? ????,????????? ????-????? ????, ?? ???? ????????.
- ????? ???? ????, ?? ???? ???OK:
RegSvr32 C:\Windows\System32\VBPrnDlg.dll
????????? ???? ?? ?? ???? ?? ????? ??? ?? ??? ??? ?? DLL ???? ?? ??? ???????? ???? ?? ?? ????? ?????
?? DLL ?? ??????? ??????????? ????? ??????? ???? ???
Printerdlg ???? ?????????
?? DLL ?? COM ??? ?? ?? ???? Visual Basic ????????? ?? ??? ??? ?????? ?? ??? ??? ????? ??? ??? DLL ??????, ?? ??? ?? ??? ????? ?? ??? ??? ????????? ???? ?? ???
??????? ????????? ????? ?? ?????????? ?? ??? ???? ?? ?? ??????? ??????? ???? ?? ????
?? ??????? ?? ??????? ?? ???? ??
??????? ????????? ????? ???
CommonDialogVisual Basic ??? ????????? ?????
????? ????? ?? ???
?? ????? ??? ?? ???? ?? ???? ??? ????????? ?? ??? ???????? ?? ??? ?????
CommonDialog???????? ???
Printer.hdc-???? ????? ?? ???, ?? ????? ??? ????? ??? ?????? ??????? ??? ??????? ????? (*) ?? ???? ?? ?? ?? ???
???????????????, ?? ?? ????? ???????? ?? ????? ????:
Printer.Copies = printDlg.Copies
- ?????????
- ?????????
- ColorMode
- DriverName
- Duplex
- PaperBin
- PaperSize
- ?????
- PrintQuality
- hDC
- ?????????? *
- ??????? *
- ?????? *
- FromPage *
- ToPage *
?????????????? ?? ??? ???
DeviceName?????
??????????????? ??? ??????? ????? ?? ??? ??????? ????? ??? ??? (*) ??? ?????? ??????? ?? ??? ????? ??????? ???? ???? ????? ?? ????????? ???? ?? ??? ????? ??? ???? ????
????? ???? ?? ???
????? ?? ??? ???????
??????? ????????? ????? ?? ??????? ?? ??? ?? .
Max??? ???? ?? ??? ??? ?????? ???? ????? ?? ?? ???? ??
???????. ???
????????? ???? ??
Max, ?????? ?? ??? ?? ?? ????? ????? ????? ???? ??? ??? ?????????? ??? ????? ?? ??? ???? ??
PrinterDlg???????? ?? ???? ?? ???? ?? ?? ????????? ???? ??
???????, ??
Max, ?? ??? ??? ???? ??? ??
FromPage, ??
ToPage???. ?? ??? ???? ???? ??? ??
???????????????, ????? ????? ????? raises ?? ?????? ?? ????????? ???? ?? ?? ????????? ?? ????? ?? ????? ???? ?????
????? ???????? ??????? ?? ???
- ????-?? ?? ???? ???????? ???CommonDialog???????? ??? ??? ????? ????? ?? ???????? ??? ?????????? ?? ??? using "??" ??? ????? ????? ?? ??? ??? ??VBPrinterConstants?????? ??? ?????? ?? ???::
printDlg.Flags = VBPrinterConstants.cdlPDDisablePrintToFile _
Or VBPrinterConstants.cdlPDNoPageNums
?? ????? ???:
Constant Value Description
---------------------------------------------------------------------------
cdlPDAllPages &H0 Returns or sets the state of the All
Pages option button.
cdlPDCollate &H10 Returns or sets the state of the
Collate check box.
cdlPDDisablePrintToFile &H80000 Disables the Print To File check box.
cdlPDHelpButton &H800 Causes the dialog box to display the
Help button.
cdlPDHidePrintToFile &H100000 Hides the Print To File check box.
cdlPDNoPageNums &H8 Disables the Pages option button and
the associated edit control.
cdlPDNoSelection &H4 Disables the Selection option button.
cdlPDNoWarning &H80 Prevents a warning message from being
displayed when there is no default
printer.
cdlPDPageNums &H2 Returns or sets the state of the
Pages option button.
cdlPDPrintSetup &H40 Causes the system to display the
Print Setup dialog box instead of
the Print dialog box.
cdlPDPrintToFile &H20 Returns or sets the state of the
Print To File check box.
cdlPDReturnDC &H100 Returns a device context for the
printer selection made in the dialog
box. The device context is returned
in the hDC property of the dialog
box.
cdlPDReturnDefault &H400 Returns the default printer name.
cdlPDReturnIC &H200 Returns an information context for
the printer selection made in the
dialog box. An information context
provides a fast way to get
information about the device without
creating a device context. The
information context is returned in
the hDC property of the dialog box.
cdlPDSelection &H1 Returns or sets the state of the
Selection option button. If neither
cdlPDPageNums nor cdlPDSelection is
specified, the All option button is
in the selected state.
cdlPDUseDevModeCopies &H40000 If a printer driver does not support
multiple copies, setting this flag
disables the Number of Copies spinner
control in the Print dialog box. If a
driver does support multiple copies,
setting this flag indicates that the
dialog box stores the requested
number of copies in the Copies
property.
?? ????? ?? ???? ?????????? ?????????? ?? ???? ???? ????? ???? ????????? ???? ?? ??? ??????? ??? ??????? ????. ??? ???? ?? ??? ????? ??? ????? ?? ???cdlPDPrintToFile???? ??? ???? ??? ?? ????? ????? ????????? ???? ?? ???????? ???? ??? ???
- CancelError-?? ????????? ???? ?? ?? ???? ??? ?????? ?? ?? ????????? ?? ??? ?????????? ????? ???? ?? ??? ??? ?????? ???? ?????? ????. ???????? ??? ??, ?? ?? false, ????? ??? ?????? ??????? ???? ???? ??? ?????????? ????? ???? ?????? ????. ?? ??? ???? ?? ??? ??? ??, ?? ?????? ?????? 32755 (& H7FF3) ?? ???? ?? ?????????? ????? ???? ?????? ????. ???? ?? ?????? ???? ????? ?? ???? ???? ?????? ?????????? ?? ' ????? ????? ?? ????? ???? ?? ??? trap ?? ???? ????
- ShowPrinter-?? ?? ???? ??? ??????? ????? ??? ?? ?????? ?? ??? ???? ????? ????? ????????? ???? ??? ?? ?????? ????? ?? ????? ???????? ?? ??? ??? ??????? ?? ??? ?????? ?? ???, ????? ???? ??? ?????? ????:
printDlg.ShowPrinter Me.hWnd
????? ?? ?? ???? ??? ???? ????? ??? ?? ??? ??? ?????????? ????? ???? ????????? ???????? ?? (??????, ??? ?????????? ????? ???? ?? ???????? ????).
???:: ??? ?? ????????, ???
printDlg?? DLL ??? ????? ?? ?? ???? ?? ?? ?????? ??? ????? ??? ?? ????? ?? ??? declared ??:
Dim printDlg As PrinterDlg
Set printDlg = New PrinterDlg
????? ????? ???? ?? ??? ???
????? ?? ??? ?? ????? ????????? ?? ?????????? ?? ???????????? ????????? ???? ?? ???? ??? ????? ???? ???? ?? ??? ?????? ????? ?? ??? DLL ?? ????? ?????, ?? ????? ?? ???? ????:
- ??? Microsoft Visual Basic, ????? ??? ???? EXE ?????????? ???????? ??? ??, Form1 ??? ???? ???? ??..
- ????? ????????????????? ??,??????.
- ??? ????Microsoft VB ??????? Dialog(PSS)?? ????-????? ????, ?? ???? ???OK.
- ????? ???CommandButton????????? ???? ?? ??? ???????? ???????? ??? ??,Command1????? ??? ???
- ???-????? ????Command1.
- ??? ????? ??? ???????Command1_Click?????:
Dim printDlg As PrinterDlg
Set printDlg = New PrinterDlg
' Set the starting information for the dialog box based on the current
' printer settings.
printDlg.PrinterName = Printer.DeviceName
printDlg.DriverName = Printer.DriverName
printDlg.Port = Printer.Port
' Set the default PaperBin so that a valid value is returned even
' in the Cancel case.
printDlg.PaperBin = Printer.PaperBin
' Set the flags for the PrinterDlg object using the same flags as in the
' common dialog control. The structure starts with VBPrinterConstants.
printDlg.Flags = VBPrinterConstants.cdlPDNoSelection _
Or VBPrinterConstants.cdlPDNoPageNums _
Or VBPrinterConstants.cdlPDReturnDC
Printer.TrackDefault = False
' When CancelError is set to True the ShowPrinterDlg will return error
' 32755. You can handle the error to know when the Cancel button was
' clicked. Enable this by uncommenting the lines prefixed with "'**".
'**printDlg.CancelError = True
' Add error handling for Cancel.
'**On Error GoTo Cancel
If Not printDlg.ShowPrinter(Me.hWnd) Then
Debug.Print "Cancel Selected"
Exit Sub
End If
'Turn off Error Handling for Cancel.
'**On Error GoTo 0
Dim NewPrinterName As String
Dim objPrinter As Printer
Dim strsetting As String
' Locate the printer that the user selected in the Printers collection.
NewPrinterName = UCase$(printDlg.PrinterName)
If Printer.DeviceName <> NewPrinterName Then
For Each objPrinter In Printers
If UCase$(objPrinter.DeviceName) = NewPrinterName Then
Set Printer = objPrinter
End If
Next
End If
' Copy user input from the dialog box to the properties of the selected printer.
Printer.Copies = printDlg.Copies
Printer.Orientation = printDlg.Orientation
Printer.ColorMode = printDlg.ColorMode
Printer.Duplex = printDlg.Duplex
Printer.PaperBin = printDlg.PaperBin
Printer.PaperSize = printDlg.PaperSize
Printer.PrintQuality = printDlg.PrintQuality
' Display the results in the immediate (Debug) window.
' NOTE: Supported values for PaperBin and Size are printer specific. Some
' common defaults are defined in the Win32 SDK in MSDN and in Visual Basic.
' Print quality is the number of dots per inch.
With Printer
Debug.Print .DeviceName
If .Orientation = 1 Then
strsetting = "Portrait. "
Else
strsetting = "Landscape. "
End If
Debug.Print "Copies = " & .Copies, "Orientation = " & _
strsetting
If .ColorMode = 1 Then
strsetting = "Black and White. "
Else
strsetting = "Color. "
End If
Debug.Print "ColorMode = " & strsetting
If .Duplex = 1 Then
strsetting = "None. "
ElseIf .Duplex = 2 Then
strsetting = "Horizontal/Long Edge. "
ElseIf .Duplex = 3 Then
strsetting = "Vertical/Short Edge. "
Else
strsetting = "Unknown. "
End If
Debug.Print "Duplex = " & strsetting
Debug.Print "PaperBin = " & .PaperBin
Debug.Print "PaperSize = " & .PaperSize
Debug.Print "PrintQuality = " & .PrintQuality
If (printDlg.Flags And VBPrinterConstants.cdlPDPrintToFile) = _
VBPrinterConstants.cdlPDPrintToFile Then
Debug.Print "Print to File Selected"
Else
Debug.Print "Print to File Not Selected"
End If
Debug.Print "hDC = " & printDlg.hDC
End With
Exit Sub
'**Cancel:
'**If Err.Number = 32755 Then
'** Debug.Print "Cancel Selected"
'**Else
'** Debug.Print "A nonCancel Error Occured - "; Err.Number
'**End If
- ???? ???? ??????? ???? ?? ??? ?? ????????? ?? ??????? ???? ?? ??? F5 ????? ?????? ????? ????,Command1????? ?? ?????????? ????????? ????? ?? ??????? ?? ??? ?? ..
- ?? ????? ?? ?????????? ????????? ????? ???, ?? ?? ?????? ?? ???? ????? ??? ??????
???:: ??? ?? ????? ??? ?? ????? ?? ?????????? ?????? ????? ???? ??? ????? ???? ?? ??? ?? ??????? ??????
???? ????(???? ??????? ?? ??? ???? ??
CommonDialog????????), ????????? ??? prefixed uncomment "' **"?
Visual Basic ??? ?????? ????? ????? ?? ????? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
173981
(http://support.microsoft.com/kb/173981/EN-US/
)
PRB: ????? ???????????? ?? ?????? ????? ?? ??????? ????
??????? ???????? ?? ???? ??? ???????? ??????? ?? ??? ?????? ?? Microsoft ???????? ??? ????? ?? ??? ????? ???? ???????? ?? ????? ????:
190218
(http://support.microsoft.com/kb/190218/EN-US/
)
HOWTO: ??? ??????? ??????? ??????? ????????
194789
(http://support.microsoft.com/kb/194789/EN-US/
)
HOWTO: ???????? DeviceCapabilities API ?? ?????? PaperBins