MartyConnelly
martyconnelly at shaw.ca
Thu Jun 26 14:02:27 CDT 2003
You might be able to interrogate the printer statuses via winspool.drv
depending on how hard they have locked it down.
Private Declare Function GetJob Lib "winspool.drv" Alias "GetJobA" _
(ByVal hPrinter As Long, _
ByVal JobId As Long, _
ByVal Level As Long, _
buffer As Long, _
ByVal pbSize As Long, _
pbSizeNeeded As Long) As Long
Private Declare Function SetJob Lib "winspool.drv" Alias _
"SetJobA" (ByVal hPrinter As Long, _
ByVal JobId As Long, _
ByVal Level As Long, _
pJob As Long, _
ByVal Command As Long) As Long
Public Enum PrintJobStatuses
JOB_STATUS_PAUSED = &H1
JOB_STATUS_ERROR = &H2
JOB_STATUS_DELETING = &H4
JOB_STATUS_SPOOLING = &H8
JOB_STATUS_PRINTING = &H10
JOB_STATUS_OFFLINE = &H20
JOB_STATUS_PAPEROUT = &H40
JOB_STATUS_PRINTER = &H80
JOB_STATUS_DELETED = &H100
JOB_STATUS_BLOCKED_DEVICEQUEUE = &H200
JOB_STATUS_USER_INTERVENTION = &H400
JOB_STATUS_RESTART = &H800
End Enum
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Type JOB_INFO_1
JobId As Long
lpPrinterName As String
lpMachinename As String
lpUserName As String
lpDocumentName As String
lpDataType As String
lpStatus As String
Status As PrintJobStatuses
Priority As Long
Position As Long
TotalPages As Long
PagesPrinted As Long
Submitted As SYSTEMTIME
End Type
Private Type JOB_INFO_2
JobId As Long
lpPrinterName As String
lpMachinename As String
lpUserName As String
lpDocumentName As String
lpNotifyName As String
lpDataType As String
lpPrintProcessor As String
lpParameters As String
lpDriverName As String
lpDevMode As Long 'Pointer to DevMode
lpStatus As String
lpSecurityDescriptor As Long 'Pointer to SECURITY_DESCRIPTOR
Status As PrintJobStatuses
Priority As Long
Position As Long
StartTime As Long
UntilTime As Long
TotalPages As Long
JobSize As Long
Submitted As SYSTEMTIME
time As Long
PagesPrinted As Long
End Type
'\\ Included in WINNT4 and beyond
Private Type JOB_INFO_3
JobId As Long
NextJobId As Long
Reserved As Long 'must be set to zero
End Type
Henry Simpson wrote:
> I don't really know this outfit's architecture. They have a file
> server and a terminal server, a good number of Win CE terminals at the
> site plus off site terminals and three Lexmark laser printers with
> NICs connected to the LAN. There is also a single workstation running
> Win2k that was idle at the time as well as two or three Win2k laptops
> which were doing whatever they do. I have no priveleges at this
> security conscious site so do not have access to the Pinters in Win
> Explorer for properites, print queues, control panel or any other
> information. They have had spontaneous Terminal server reboots when
> large graphics files were sent to the color laser in high resolution
> modes and it has also rebooted once when it was sent a batch of 80
> Word documents in a quick loop. These spontaneous reboots have only
> started since they switched to a thin client environment. The
> resource crash was clearly instigated by the multiple Word instances
> since clearing them allowed users to continue working for a time.
> There is no doubt that printing has been an issue in recent months.
>
> Hen
>
>
>> From: Drew Wutka <DWUTKA at marlow.com>
>> Reply-To: accessd at databaseadvisors.com
>> To: "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
>> Subject: RE: [AccessD] OT: TS and Automation
>> Date: Thu, 26 Jun 2003 11:41:24 -0500
>>
>> Where was the printer running from, was it on a print server. There
>> is a
>> known print server bug between NT 4.0 print servers and Windows 2000
>> machines. It causes a massive amount of connections, which exceeds
>> NT 4.0's
>> limit.....which doesn't really show up as memory or CPU resources,
>> however,
>> it completely blocks access to the print server (so if it is also a
>> PDC or
>> BDC, you just locked a lot of people out of the network)
>>
>> Drew
>>
>> -----Original Message-----
>> From: Henry Simpson [mailto:hsimpson88 at hotmail.com]
>> Sent: Thursday, June 26, 2003 11:24 AM
>> To: accessd at databaseadvisors.com
>> Subject: [AccessD] OT: TS and Automation
>>
>>
>> Yesterday some users ran some automation code that creates Word
>> instances in
>>
>> a loop and kills them after printing but it turns out that the
>> printer was
>> so slow that the number or Word instances increased to the point that
>> the NT
>>
>> Terminal Server ran out of some kinds of resources and started giving
>> spurious error messages about not finding a printer, being unable to
>> install
>>
>> a printer and then User32.dll errors and path not found errors. One
>> user
>> was eventually unable to open any applications except that which was
>> already
>>
>> open. An admin cleared the excess Word instances, as many as 18 that
>> outran
>>
>> the printer, and then the user was able to work for a while.
>> Ultimately,
>> afflicted users logged right out and back in again as a precaution.
>>
>> After that, more and more users began to have problems and
>> ultimately, no
>> one was able to log in to the server. Before it all completely
>> failed, an
>> admin took a look at resource and there was plenty of memory and low
>> processor usage and all unnecessary instances of applications were
>> cleared
>> yet every single person started getting the user32.dll error and, after
>> logging out, was unable to log back in due to a time out even though the
>> Terminal Server was on a local LAN. The admin was able to see that all
>> users were out and no user applications were running but he also got a
>> user32.dll error from which there was no recovery. An attempt to
>> restart
>> from Task Manager gave the same user32.dll errors and after 45
>> minutes of
>> recovery attempts, it was finally decided to interrupt the power off the
>> server.
>>
>> Ultimately Access automation code took full responsibility for the
>> fiasco
>> and the Terminal Server was blameless.
>>
>> I'm not desperate for solutions as code can revert to a single Word
>> instance
>>
>> - multi Document with 20 second time delay approach that worked in
>> the past.
>>
>> I could use help with code that pauses the Access automation while it
>> waits for a print job to complete. So far I've dabbled with
>>
>> objWord.Options.PrintBackground = False
>> objDoc.PrintOut Background:=False
>>
>>
>> What gets me is the Admin view that the Access code is responsible
>> for their
>>
>> inability to release resources that were some how used but didn't
>> show up in
>>
>> any resource monitors or error logging.
>>
>> Hen
>>
>> _________________________________________________________________
>> Tired of spam? Get advanced junk mail protection with MSN 8.
>> http://join.msn.com/?page=features/junkmail
>>
>> _______________________________________________
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>> _______________________________________________
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>