Domino 9 und frühere Versionen > Entwicklung

Drucker und Druckoptionen einstellen

<< < (11/13) > >>

enny:
Mein Vorteil ist das ich Eingabe und Druckmaske in meiner DB habe die ich entwickle. Ich gebe dem User somit in der Eingabemaske lediglich die Möglichkeit sich die Vorschau anzusehen und anschließend müssen Sie dann eben noch einen Button zum Drucken drücken. Ist zwar keine Lösung für das Problem aber damit habe ich dann zwei getrennte Scripts und dann sollte es auch gehen!

eknori:
Ich habe hier noch eine Funktion, die ein SLEEP ohne das komplette Blockieren der weiteren Codebearbeitung ermöglicht.

Declarations:
'********************************************
 Const STATUS_TIMEOUT = &H102&
 Const INFINITE = -1& ' Infinite interval
 Const QS_KEY = &H1&
 Const QS_MOUSEMOVE = &H2&
 Const QS_MOUSEBUTTON = &H4&
 Const QS_POSTMESSAGE = &H8&
 Const QS_TIMER = &H10&
 Const QS_PAINT = &H20&
 Const QS_SENDMESSAGE = &H40&
 Const QS_HOTKEY = &H80&
 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)
 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
 Declare Function GetTickCount Lib "kernel32" () As Long

Code:
' The MsgWaitObj function replaces Sleep,
' WaitForSingleObject, WaitForMultipleObjects functions.
' Unlike these functions, it
' doesn't block thread messages processing.
' Using instead Sleep:
'     MsgWaitObj dwMilliseconds
' Using instead WaitForSingleObject:
'     retval = MsgWaitObj(dwMilliseconds, hObj, 1&)
' Using instead WaitForMultipleObjects:
'     retval = MsgWaitObj(dwMilliseconds, hObj(0&), n),
'     where n - wait objects quantity,
'     hObj() - their handles array.

 Function MsgWaitObj(Interval As Long,hObj As Long,nObj As Long ) As Long
Dim T As Long, T1 As Long
If Interval <> INFINITE Then
    T = GetTickCount()
    On Error Resume Next
    T = T + Interval
    ' Overflow prevention
    If Err <> 0& Then
        If T > 0& Then
            T = ((T + &H80000000) _
            + Interval) + &H80000000
        Else
            T = ((T - &H80000000) _
            + Interval) - &H80000000
        End If
    End If
    On Error GoTo 0
    ' T contains now absolute time of the end of interval
Else
    T1 = INFINITE
End If
Do
    If Interval <> INFINITE Then
        T1 = GetTickCount()
        On Error Resume Next
     T1 = T - T1
        ' Overflow prevention
        If Err <> 0& Then
            If T > 0& Then
                T1 = ((T + &H80000000) _
                - (T1 - &H80000000))
            Else
                T1 = ((T - &H80000000) _
                - (T1 + &H80000000))
            End If
        End If
        On Error GoTo 0
        ' T1 contains now the remaining interval part
        ' ACHTUNG: Fürr LS muß das folgende IIF noch aufgelöst werden
        If IIf((T1 Xor Interval) > 0&, _
            T1 > Interval, T1 < 0&) Then
            ' Interval expired
            ' during DoEvents
            MsgWaitObj = STATUS_TIMEOUT
            Exit Function
        End If
    End If
    ' Wait for event, interval expiration
    ' or message appearance in thread queue
    MsgWaitObj = MsgWaitForMultipleObjects(nObj, _
            hObj, 0&, T1, QS_ALLINPUT)
    ' Let's message be processed
    DoEvents
    If MsgWaitObj <> nObj Then Exit Function
    ' It was message - continue to wait
Loop
End Function

Rob Green:
evtl hilft Euch dieser Link ein bißerl weiter:

http://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20506162.html

incl. einer gezippten Bsp DB mit API Calls: http://www.icejersey.com/dev/printerchange.zip

Der Bursch hat es für WinNT/W2k geschafft, allerdings scheint es bei der Combo R6/Win98 Probleme zu geben, nämlich genau der Art wie Ihr sie schon entdeckt habt:
"Wow!! This is proving to be a real pain, the SendMessage call does change the default printer but notes doesn't recognise it.  However if you change the default printer manually Notes does recognise the changes.

I am trying out some other things and I think I am getting close, this lot seems to work with windows NT/2000 but Win98 is not playing ball.
I just need to work out what windows98 does after the user changes the default printer manually to see if I can do the same. Soon as I find this out we should be sorted..
Sorry this is taking a while faithsg "
Das war am 28.03.


(Seine Erläuterungen zur DB:
Hi Faithsg,

I have put together a sample of a printer change system
I have had it working on my computer so you shouldn't have any problems using it.

You should be able to copy/paste bits of it into your database; the essential items you need to look at are as follows.

1) Script Library - this holds all the api calls and other goodies and is called "PrinterChange"
2) In the main form you need to look at the form globals, PostOpen event and QueryClose event
3) Lastly you need to see the code behind the two buttons, these buttons call the functions in the script library.


Click on the following link to download example
http://www.icejersey.com/dev/printerchange.zip

Hope this helps, Notes can be a pain to change printers, after looking myself for aaagggeeeessssss I managed to find out that setting the printer to default then back again is the only way to get the job done.

One last thing, you need to be on Notes 5.0.10 or later for this to work, if your on a lower version you have do an incremental upgrade by visiting the notes website, look out for MR (Maintanance release).

Good luck,  Joe.)

enny:
Ich konnte mir die Datei leider nicht runterladen aber kann mir mal jemand sagen ob er vielleicht im PostOpen bereits den Drucker umstellt denn dann wär das nichts neues. Das wollte ich ja auch so lösen. Beim öffnen den Drucker umstellen und dann die User über einen Button drucken lassen. Wo wir wieder bei dem Thema wären das es zwei von einander getrennte Skripts währen!

eknori:
YEAH, das funzt bei mir ( momentan NT4 SP 6a und Client 5.0.11 )  :D :D :D

Kommando zurück   :'( :'( :'( :'(

Das funktioniert nur, wenn man das SetDefault Printer und Print Kommando trennt.

In einer Aktion klappt das nicht. Also nichts neues

Nachtrag:

scheint wohl probleme mit dem DL zu geben, daher hier die Datei:

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln