我正在更新我们的“打印机监控”应用程序。以前此应用程序在 Windows 2000 服务器上成功运行。现在我们转移到 Windows 7 服务器。在 Windows 7 上,我们的“打印监视器”应用程序崩溃。当我调试它时,我发现我们的SetJob
函数抛出了以下异常:
参数不正确。
有人对这个有了解吗?
函数调用:
SetJob(
mhPrinter,
midJob,
0,
IntPtr.Zero,
PrintJobControlCommands.JOB_CONTROL_PAUSE) 'Here exception is thrown
我们使用的 Spooler API:
<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