tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
8
ZUGRIFFE
2742
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Udo Udo ist offline Mitglied Gold
    Registriert seit
    Jan 2002
    Beiträge
    105
    Hallo Leute!

    Ich mache mit dem Printerobject einen Ausdruck --> ist klar!!

    Mein Programm beinhaltet so ne art serienbrief, wie man es von MsWord kennt!!

    Der Benutzer kann dann seine Empfänger-Andressen aussuchen, die aus einer Datenbank ausgelesen werden!

    Dann gehe ich in eine Schleife in der ich die Printer ausgabe mache, und die schleife läuft so lang bis das Recordset-Object End of file ist:

    Do Until rs.EOF
    Printer.Print rs.fields("Vorname")
    usw....
    Printer.Enddoc '*** oder so irgendwie heißt das
    loop

    Ok, ist alles kein problem, er druckt mir das auch so wie ich das haben will, aber mein Windows-Druckprozess bringt mir dann einen Fehler:

    ****
    Die Datei "Der Druckprozess" hat einen Fehler verursacht!
    ****

    Habe keine Ahnung warum dieser Windows-Fehler kommt, hat vielleicht schein einmal das problem gehabt**** Eigentlich ist es kein wirkliches Problem, weil das Programm ja das macht was es tun soll, aber das ist für einen Kunden und es sieht blöd aus wenn da ein fehler kommt!!

    Bitte um Hilfe
     
    CU Udo
    %):--

  2. #2
    ITiger ITiger ist offline Mitglied Bronze
    Registriert seit
    Oct 2002
    Ort
    BW
    Beiträge
    36
    Hi erstmal...

    Wenn Du dem Drucker das Enddoc Kommando in der Schleife gibst, druckt der dann nicht bei jedem Durchlauf der Schleife eine neue Seite aus? Nur so'n Gedanke. Ich würde das mal prüfen...

    Gruss ITiger.
     
    And God saw that "IT" was good...

  3. #3
    Udo Udo ist offline Mitglied Gold
    Registriert seit
    Jan 2002
    Beiträge
    105
    Hi,

    ja er beginnt mit jedem Enddoc befehl eine Neue seite, das soll er auch so machen, denn er soll für jede Empfängeradresse die er ausgewählt hat einen eigenen Brief generieren!!
     
    CU Udo
    %):--

  4. #4
    ITiger ITiger ist offline Mitglied Bronze
    Registriert seit
    Oct 2002
    Ort
    BW
    Beiträge
    36
    Wieviele willst Du denn auf einmal drucken?

    Vielleicht tuts ja ein Wait nach einem Druckvorgang (oder nach 10)...

    Könnte sein, dass er einfach ZUVIEL drucken soll, und er kann nicht so viele Aufträge auf einmal in die Warteschlange schicken...

    Naja, eigentlich hab ich keine Ahnung, aber ich wollte halt versuchen zu helfen, da asphyxia ja scheinbar nicht da ist

    Gruss ITiger.
     
    And God saw that "IT" was good...

  5. #5
    Udo Udo ist offline Mitglied Gold
    Registriert seit
    Jan 2002
    Beiträge
    105
    Hab auch schon gemerkt das asphyxia nicht da ist, weil sonst hätte er schonlange seinen kommentar dazu abgegeben!!

    Zum Problem:

    Danke für deine Hilfe******

    Der Fehler kommt sobald ich mehr als einen Druck auftrag in die Warteschleife setzte also ab 2 Druckaufträge kommt der Fehler!!

    Wie ist das mit dem Wait, was macht das und wie implementiere ich das genau****

    THX Udo
     
    CU Udo
    %):--

  6. #6
    Registriert seit
    Nov 2001
    Ort
    Gießen
    Beiträge
    4.091
    schön, dass ihr mich vermisst. =)

    zum thema:
    wie sieht denn der gesamte code aus und was sagt der debugger dazu? möglicherweise kriegt das drucker-objekt kleine probleme, wenn mehr als zwei seiten direkt hintereinander gedruckt werden sollen.
     
    "You could say that I was too lazy to calculate and so I invented the computer." -- Konrad Zuse

  7. #7
    ITiger ITiger ist offline Mitglied Bronze
    Registriert seit
    Oct 2002
    Ort
    BW
    Beiträge
    36
    Code :
    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
    
     
    Private Type FILETIME
        dwLowDateTime As Long
        dwHighDateTime As Long
    End Type
     
    Private Const WAIT_ABANDONED& = &H80&
    Private Const WAIT_ABANDONED_0& = &H80&
    Private Const WAIT_FAILED& = -1&
    Private Const WAIT_IO_COMPLETION& = &HC0&
    Private Const WAIT_OBJECT_0& = 0
    Private Const WAIT_OBJECT_1& = 1
    Private Const WAIT_TIMEOUT& = &H102&
     
    Private Const INFINITE = &HFFFF
    Private Const ERROR_ALREADY_EXISTS = 183&
     
    Private Const QS_HOTKEY& = &H80
    Private Const QS_KEY& = &H1
    Private Const QS_MOUSEBUTTON& = &H4
    Private Const QS_MOUSEMOVE& = &H2
    Private Const QS_PAINT& = &H20
    Private Const QS_POSTMESSAGE& = &H8
    Private Const QS_SENDMESSAGE& = &H40
    Private Const QS_TIMER& = &H10
    Private Const QS_MOUSE& = (QS_MOUSEMOVE _
                                Or QS_MOUSEBUTTON)
    Private Const QS_INPUT& = (QS_MOUSE _
                                Or QS_KEY)
    Private Const QS_ALLEVENTS& = (QS_INPUT _
                                Or QS_POSTMESSAGE _
                                Or QS_TIMER _
                                Or QS_PAINT _
                                Or QS_HOTKEY)
    Private Const QS_ALLINPUT& = (QS_SENDMESSAGE _
                                Or QS_PAINT _
                                Or QS_TIMER _
                                Or QS_POSTMESSAGE _
                                Or QS_MOUSEBUTTON _
                                Or QS_MOUSEMOVE _
                                Or QS_HOTKEY _
                                Or QS_KEY)
     
    Private Declare Function CreateWaitableTimer Lib "kernel32" _
        Alias "CreateWaitableTimerA" ( _
        ByVal lpSemaphoreAttributes As Long, _
        ByVal bManualReset As Long, _
        ByVal lpName As String) As Long
        
    Private Declare Function OpenWaitableTimer Lib "kernel32" _
        Alias "OpenWaitableTimerA" ( _
        ByVal dwDesiredAccess As Long, _
        ByVal bInheritHandle As Long, _
        ByVal lpName As String) As Long
        
    Private Declare Function SetWaitableTimer Lib "kernel32" ( _
        ByVal hTimer As Long, _
        lpDueTime As FILETIME, _
        ByVal lPeriod As Long, _
        ByVal pfnCompletionRoutine As Long, _
        ByVal lpArgToCompletionRoutine As Long, _
        ByVal fResume As Long) As Long
        
    Private Declare Function CancelWaitableTimer Lib "kernel32" ( _
        ByVal hTimer As Long)
        
    Private Declare Function CloseHandle Lib "kernel32" ( _
        ByVal hObject As Long) As Long
        
    Private Declare Function WaitForSingleObject Lib "kernel32" ( _
        ByVal hHandle As Long, _
        ByVal dwMilliseconds As Long) As Long
        
    Private Declare Function MsgWaitForMultipleObjects Lib "user32" ( _
        ByVal nCount As Long, _
        pHandles As Long, _
        ByVal fWaitAll As Long, _
        ByVal dwMilliseconds As Long, _
        ByVal dwWakeMask As Long) As Long
     
    Public Sub Wait(lNumberOfSeconds As Long)
        Dim ft As FILETIME
        Dim lBusy As Long
        Dim lRet As Long
        Dim dblDelay As Double
        Dim dblDelayLow As Double
        Dim dblUnits As Double
        Dim hTimer As Long
        
        hTimer = CreateWaitableTimer(0, True, App.EXEName & "Timer")
        
        If Err.LastDllError = ERROR_ALREADY_EXISTS Then
            ' If the timer already exists, it does not hurt to open it
            ' as long as the person who is trying to open it has the
            ' proper access rights.
        Else
            ft.dwLowDateTime = -1
            ft.dwHighDateTime = -1
            lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, 0)
        End If
        
        ' Convert the Units to nanoseconds.
        dblUnits = CDbl(&H10000) * CDbl(&H10000)
        dblDelay = CDbl(lNumberOfSeconds) * 1000 * 10000
        
        ' By setting the high/low time to a negative number, it tells
        ' the Wait (in SetWaitableTimer) to use an offset time as
        ' opposed to a hardcoded time. If it were positive, it would
        ' try to convert the value to GMT.
        ft.dwHighDateTime = -CLng(dblDelay / dblUnits) - 1
        dblDelayLow = -dblUnits * (dblDelay / dblUnits - _
            Fix(dblDelay / dblUnits))
        
        If dblDelayLow < CDbl(&H80000000) Then
            ' &H80000000 is MAX_LONG, so you are just making sure
            ' that you don't overflow when you try to stick it into
            ' the FILETIME structure.
            dblDelayLow = dblUnits + dblDelayLow
        End If
        
        ft.dwLowDateTime = CLng(dblDelayLow)
        lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, False)
        
        Do
            ' QS_ALLINPUT means that MsgWaitForMultipleObjects will
            ' return every time the thread in which it is running gets
            ' a message. If you wanted to handle messages in here you could,
            ' but by calling Doevents you are letting DefWindowProc
            ' do its normal windows message handling---Like DDE, etc.
            lBusy = MsgWaitForMultipleObjects(1, hTimer, False, _
                INFINITE, QS_ALLINPUT&)
            DoEvents
        Loop Until lBusy = WAIT_OBJECT_0
        
        ' Close the handles when you are done with them.
        CloseHandle hTimer
     
    End Sub

    Kopiere das einfach in ein Modul, und rufe die Funktion auf über Wait(Sekunden) also Wait(5) ist eine Pause von 5 Sekunden.

    Ich weiss zwar nicht obs was bringt, aber versuchs mal.

    Der Code ist nicht von mir...

    Gruss ITiger.
    Geändert von ITiger (01.11.02 um 07:41 Uhr)
     
    And God saw that "IT" was good...

  8. #8
    Udo Udo ist offline Mitglied Gold
    Registriert seit
    Jan 2002
    Beiträge
    105
    Hallo Leute, danke für eure Hilfe******

    Mir ist es jetzt etwas peinlich, habe keine probleme mit dem VB-Proggi gehabt sondern mit meinem Drucker selbst, hab ihn neu installed und alles hat funktioniert******

    Danke trotzdem für eure mühe!!

    THX Udo
     
    CU Udo
    %):--

  9. #9
    ITiger ITiger ist offline Mitglied Bronze
    Registriert seit
    Oct 2002
    Ort
    BW
    Beiträge
    36
    HAHA!

    LOL!

    Macht nix... meisstens isses einfacher als man denkt


    Cya. ITiger.
     
    And God saw that "IT" was good...

Ähnliche Themen

  1. Antworten: 4
    Letzter Beitrag: 24.10.10, 10:37
  2. Problem mit dem Drucker
    Von Miklo im Forum Hardware
    Antworten: 3
    Letzter Beitrag: 28.04.05, 12:34
  3. Drucker Problem
    Von layla im Forum Hardware
    Antworten: 3
    Letzter Beitrag: 07.02.05, 15:35
  4. Drucker Problem
    Von oKba im Forum Linux & Unix
    Antworten: 4
    Letzter Beitrag: 06.02.05, 21:02
  5. win2k3 ES + USB drucker problem
    Von xemacs im Forum Microsoft Windows
    Antworten: 5
    Letzter Beitrag: 09.09.04, 10:59