IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Installation, Déploiement et Sécurité VB Discussion :

[VB6]installation d'imprimante


Sujet :

Installation, Déploiement et Sécurité VB

  1. #1
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut [VB6]installation d'imprimante
    je m'appretais tranquillement a faire mon .hlp, et en parcourant mon applicaiton, je suis retomber sur la page de configuration de l'imprimante...

    et la, y'a un truc qui me plait moyen, et que je corrigerai bien si la tache n'est pas longue et fastidieuse.

    presentement, j'ai mon ascenseur qui m'indique toutes les imprimantes installé sur la machine. c'est super cool...

    Mais pour installer une nouvelle imprimante, on doit quitter l'appli ( la mettre en petit en tout cas, et pour une appli qui est censee marcher 24h/24, c'est bof) et l'installer avec l'aide de windos.

    est ce qu'il est possible de faire un boutom [configurer l'imprimante] qui m'ouvrirai directement cette appli de windows dont j'ignore le nom, pour installer une dite imprimante ?
    n'oubliez pas la balise

  2. #2
    Inactif  
    Avatar de jmfmarques
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    3 784
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 3 784
    Points : 4 674
    Points
    4 674
    Par défaut
    Installer ?
    ou simplement la choisir parmi celles installées ?

  3. #3
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    installé :p



    pas de compromis comme ca
    n'oubliez pas la balise

  4. #4
    Inactif  
    Avatar de jmfmarques
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    3 784
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 3 784
    Points : 4 674
    Points
    4 674
    Par défaut
    Je peux aisément te conduire jusqu'à cette fenêtre, mais pas plus loin (of course) car le reste est autre chose et demande des pilotes.... différents selon l'imprimantre à installer !
    Tu veux que je fasse ?

  5. #5
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    un ti bouton qui donne sur la fenetre de configuration d'imprimante serai parfais.

    mais la question a la con...
    Si on le fait sur une version de windows, ca marchera pour toutes les versions( au moins les connues 95, 98, 2000, xp) ?
    n'oubliez pas la balise

  6. #6
    Inactif  
    Avatar de jmfmarques
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    3 784
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 3 784
    Points : 4 674
    Points
    4 674
    Par défaut
    Oui !
    Je te le fais par Api et voilà !
    Tu le veux pour cette nuit ou pour demain ?

  7. #7
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    j'sais pas, j,vais repondre le classique pour avant hier ^^

    fais le pour quand tu peux

    ca sera deja super top-mega-cool-top-moumoutte

    [edit: de tte facon, pour moi, il est 13h05, donc la nuit, c'est dans long...

    Pis quand on y pense, si t'as pas le temps aujourd'hui ( cad avant 17h ici, donc dans 4h), t'aura tout un we pour le faire ^^
    vu que je bosse pas les we :p
    n'oubliez pas la balise

  8. #8
    Inactif  
    Avatar de jmfmarques
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    3 784
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 3 784
    Points : 4 674
    Points
    4 674
    Par défaut
    bon !
    Je vais essayer de le faire maintenant pour pouvoir aller au restaurant tranquille
    A +

  9. #9
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    XD

    Comme les jeunes quebecois le disent si bien:

    MALADE !!

    te fais pas mourrir de faim pour autant jfm .
    Pis si t'y va en charmante compagnie, fait toi toute belle au lieu de prog ( desole pour de tels familiarite...)
    n'oubliez pas la balise

  10. #10
    Inactif  
    Avatar de jmfmarques
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    3 784
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 3 784
    Points : 4 674
    Points
    4 674
    Par défaut
    Alors voilà : la totale !
    Si tu veux plus compliqué, tu n'as qy'à dire (je ferai)
    sur une form : un commandbutton command1 et ce code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     Private Sub command1_Click()
      ShowPrinter Me
    End Sub
    Dans un module :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    Private Type PRINTDLG_TYPE
      lStructSize As Long
      hwndOwner As Long
      hDevMode As Long
      hDevNames As Long
      hdc As Long
      Flags As Long
      nFromPage As Integer
      nToPage As Integer
      nMinPage As Integer
      nMaxPage As Integer
      nCopies As Integer
      hInstance As Long
      lCustData As Long
      lpfnPrintHook As Long
      lpfnSetupHook As Long
      lpPrintTemplateName As String
      lpSetupTemplateName As String
      hPrintTemplate As Long
      hSetupTemplate As Long
    End Type
    Private Type DEVNAMES_TYPE
      wDriverOffset As Integer
      wDeviceOffset As Integer
      wOutputOffset As Integer
      wDefault As Integer
      extra As String * 100
    End Type
    Const FW_NORMAL = 400
    Const DEFAULT_CHARSET = 1
    Const OUT_DEFAULT_PRECIS = 0
    Const CLIP_DEFAULT_PRECIS = 0
    Const DEFAULT_QUALITY = 0
    Const DEFAULT_PITCH = 0
    Const FF_ROMAN = 16
    Const CF_PRINTERFONTS = &H2
    Const CF_SCREENFONTS = &H1
    Const CF_BOTH = (CF_SCREENFONTS Or CF_PRINTERFONTS)
    Const CF_EFFECTS = &H100&
    Const CF_FORCEFONTEXIST = &H10000
    Const CF_INITTOLOGFONTSTRUCT = &H40&
    Const CF_LIMITSIZE = &H2000&
    Const REGULAR_FONTTYPE = &H400
    Const LF_FACESIZE = 32
    Const CCHDEVICENAME = 32
    Const CCHFORMNAME = 32
    Const GMEM_MOVEABLE = &H2
    Const GMEM_ZEROINIT = &H40
    Const DM_DUPLEX = &H1000&
    Const DM_ORIENTATION = &H1&
    Const PD_PRINTSETUP = &H40
    Const PD_DISABLEPRINTTOFILE = &H80000
    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 Integer
      dmPelsWidth As Long
      dmPelsHeight As Long
      dmDisplayFlags As Long
      dmDisplayFrequency As Long
    End Type
    Public Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
    Public Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
    Public Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
    Public Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
    Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
    Public Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG_TYPE) As Long
     
    Public Sub ShowPrinter(forma As Form, Optional PrintFlags As Long)
      Dim PrintDlg As PRINTDLG_TYPE
      Dim DVMODE As DEVMODE
      Dim DevName As DEVNAMES_TYPE
      Dim lpDevMode As Long, lpDevName As Long
      Dim bReturn As Integer
      Dim objPrinter As Printer, NewPrinterName As String
      PrintDlg.lStructSize = Len(PrintDlg)
      PrintDlg.hwndOwner = forma.hWnd
      PrintDlg.Flags = PrintFlags
      On Error Resume Next
      DVMODE.dmDeviceName = Printer.DeviceName: DVMODE.dmSize = Len(DVMODE)
      DVMODE.dmFields = DM_ORIENTATION Or DM_DUPLEX: DVMODE.dmPaperWidth = Printer.Width
      DVMODE.dmOrientation = Printer.Orientation: DVMODE.dmPaperSize = Printer.PaperSize
      DVMODE.dmDuplex = Printer.Duplex
      On Error GoTo 0
      PrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DVMODE))
      lpDevMode = GlobalLock(PrintDlg.hDevMode)
      If lpDevMode > 0 Then
        CopyMemory ByVal lpDevMode, DVMODE, Len(DVMODE)
        bReturn = GlobalUnlock(PrintDlg.hDevMode)
      End If
      With DevName
        .wDriverOffset = 8
        .wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
        .wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
        .wDefault = 0
      End With
      With Printer
        DevName.extra = .DriverName & Chr(0) & .DeviceName & Chr(0) & .Port & Chr(0)
      End With
      PrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevName))
      lpDevName = GlobalLock(PrintDlg.hDevNames)
      If lpDevName > 0 Then
        CopyMemory ByVal lpDevName, DevName, Len(DevName)
        bReturn = GlobalUnlock(lpDevName)
      End If
      If PrintDialog(PrintDlg) <> 0 Then
        lpDevName = GlobalLock(PrintDlg.hDevNames)
        CopyMemory DevName, ByVal lpDevName, 45
        bReturn = GlobalUnlock(lpDevName)
        GlobalFree PrintDlg.hDevNames
        lpDevMode = GlobalLock(PrintDlg.hDevMode)
        CopyMemory DVMODE, ByVal lpDevMode, Len(DVMODE)
        bReturn = GlobalUnlock(PrintDlg.hDevMode)
        GlobalFree PrintDlg.hDevMode
        NewPrinterName = UCase$(Left(DVMODE.dmDeviceName, InStr(DVMODE.dmDeviceName, Chr$(0)) - 1))
        If Printer.DeviceName <> NewPrinterName Then
          For Each objPrinter In Printers
            If UCase$(objPrinter.DeviceName) = NewPrinterName Then
              Set Printer = objPrinter
            End If
          Next
        End If
        On Error Resume Next
        Printer.Copies = DVMODE.dmCopies: Printer.Duplex = DVMODE.dmDuplex
        Printer.Orientation = DVMODE.dmOrientation: Printer.PaperSize = DVMODE.dmPaperSize
        Printer.PrintQuality = DVMODE.dmPrintQuality: Printer.ColorMode = DVMODE.dmColor
        Printer.PaperBin = DVMODE.dmDefaultSource
        On Error GoTo 0
      End If
    End Sub
    Mais je peux faire plus complexe encore, si tu veux !!!

  11. #11
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    meuh nan, deja la je crois que jecomprend pas tout...

    je regarde si ca marche, et je te bouhte
    n'oubliez pas la balise

  12. #12
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    glop glop tout ca !!!


    marchi beaucoup jfmarques !!

    Et bon resto ^^
    n'oubliez pas la balise

  13. #13
    Membre actif Avatar de riesseg
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    415
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 415
    Points : 251
    Points
    251
    Par défaut
    bin en fait, il s'avere que le bouton a fait planter l'appli sur le PC test...

    J'sais pas du tout pourquoi... mais c'est un fait...

    Donc si ca se trouve, t'aura fait tout ca pour rien jfmarques :p
    Aller, on va dire pas pour rien, ca t'aura mit en appetit pour ton repas ^^
    n'oubliez pas la balise

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Installer une imprimante sans le cd
    Par Lanny dans le forum Périphériques
    Réponses: 5
    Dernier message: 02/01/2006, 20h49
  2. Réponses: 3
    Dernier message: 13/10/2005, 18h56
  3. [VB6] images et imprimantes
    Par tomnie dans le forum VB 6 et antérieur
    Réponses: 7
    Dernier message: 29/04/2003, 17h53
  4. [VB6] [Install] Associer une icone à un raccourci
    Par petitgognol dans le forum Installation, Déploiement et Sécurité
    Réponses: 7
    Dernier message: 30/10/2002, 20h20
  5. [VB6] [Install] Que se passe-t-il lors du setup?
    Par petit scarabée dans le forum Installation, Déploiement et Sécurité
    Réponses: 4
    Dernier message: 28/10/2002, 08h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo