I am updating our Printer Monitoring application. Previously, this application ran successfully on a Windows 2000 server. Now we switched to a Windows 7 server. In Windows 7, the Print Monitor application crashed. When I debug it, I found that our SetJob function throws the following exception:
Invalid parameter.
Does anyone know about this?
Function call:
SetJob( mhPrinter, midJob, 0, IntPtr.Zero, PrintJobControlCommands.JOB_CONTROL_PAUSE) 'Here exception is thrown
The Spooler API we use:
<DllImport("winspool.drv", EntryPoint:="SetJob", _ SetLastError:=True, CharSet:=CharSet.Ansi, _ ExactSpelling:=False, _ CallingConvention:=CallingConvention.StdCall)> _ Public Function SetJob _ (<InAttribute()> ByVal hPrinter As IntPtr, _ <InAttribute()> ByVal dwJobId As Int32, _ <InAttribute()> ByVal Level As Int32, _ <InAttribute()> ByVal lpJob As IntPtr, _ <InAttribute(), MarshalAs(UnmanagedType.U4)> ByVal dwCommand As PrintJobControlCommands _ ) As Boolean
source share