Newsgroup: it.comp.lang.visual-basic
Titolo: help VB6 e vbprndlg.dll

Salve
Vediamo un po' se qualcuno puo' aiutarmi.
Devo lanciare a stampa una picture che visualizza un'anteprima di stampa, ed 
apro una nuova istanza di printerdialog.(vbprndlg.dll regolarmete 
registrata)
Scelgo una stampante virtuale che genera PDF e stampo, sin qui tutto 
apposto. Se lancio nuovamente la stampa, quindi re-istanzio la printer 
dialog e scelgo una stampante di rete, la fa' selezionare, ma al momento in 
cui gli passo i valori scelti dalla printer dialog (printer.copies, 
ecc.ecc.) , mi genera un errore di run time 800100108, che tra l'altro non 
e' neanche gestibile, e se na va a segnalazione errori di Microsoft.
E' già successo a qualcuno ???
se SI, come avete risolto ???
e se non chiedo troppo, mi dareste qualche alternativa per selezionare la 
printer e le relative proprieta' in modo sicuro (quindi non common dilaog)
Grazie 1000 per gli eventuali suggerimenti 

 proprieta' in modo sicuro (quindi non common dilaog)
Prova in questo modo,
utilizzando solo le API:
'Metti su un form una ComboBox e un CommandButton
Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32
Private Const PRINTER_ACCESS_USE = &H8
Private Type ACL
    AclRevision As Byte
    Sbz1 As Byte
    AclSize As Integer
    AceCount As Integer
    Sbz2 As Integer
End Type
Private Type SECURITY_DESCRIPTOR
    Revision As Byte
    Sbz1 As Byte
    Control As Long
    Owner As Long
    Group As Long
    Sacl As ACL
    Dacl As ACL
End Type
Private Type DEVMODE
    dmDeviceName As String * CCHDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCHFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Long
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
End Type
Private Type PRINTER_INFO_2
    pServerName As String
    pPrinterName As String
    pShareName As String
    pPortName As String
    pDriverName As String
    pComment As String
    pLocation As String
    pDevMode As DEVMODE
    pSepFile As String
    pPrintProcessor As String
    pDatatype As String
    pParameters As String
    pSecurityDescriptor As SECURITY_DESCRIPTOR
    Attributes As Long
    Priority As Long
    DefaultPriority As Long
    StartTime As Long
    UntilTime As Long
    Status As Long
    cJobs As Long
    AveragePPM As Long
End Type
Private Type PRINTER_DEFAULTS
    pDatatype As String
    pDevMode As DEVMODE
    DesiredAccess As Long
End Type
Private Declare Function PrinterProperties Lib "winspool.drv" (ByVal hwnd As 
Long, ByVal hPrinter As Long) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As 
Long) As Long
Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" 
(ByVal pPrinterName As String, phPrinter As Long, pDefault As 
PRINTER_DEFAULTS) As Long
Private Sub Command1_Click()
    Dim PrintDef As PRINTER_DEFAULTS
    PrintDef.DesiredAccess = PRINTER_ACCESS_USE
    OpenPrinter Combo1.Text & vbNullString, pHwnd, PrintDef
    PrinterProperties hwnd, pHwnd
    ClosePrinter pHwnd
End Sub
Private Sub Form_Load()
    Dim Index As Integer
    Command1.Caption = "Proprietą"
    For i = 0 To Printers.Count - 1
        Combo1.AddItem Printers(i).DeviceName
        If Combo1.List(Combo1.NewIndex) = Printer.DeviceName Then
            Index = Combo1.NewIndex
        End If
    Next i
    Combo1.ListIndex = Index
End Sub
-- 
Ciao Fede
By Chicco Production
http://bcp.freetools.it

 ha scritto nel messaggio 
news:4929c955$0$11381$5fc...@news.tiscali.it...
