「プリンター監視」アプリケーションを更新しています。以前は、このアプリケーションは Windows 2000 サーバーで正常に動作していました。現在、Windows 7 サーバーに移行しています。Windows 7 では、「印刷モニター」アプリケーションがクラッシュします。SetJob
デバッグすると、関数が次の例外をスローすることがわかりました。
パラメータが正しくありません。
誰もこれについて何か知っていますか?
関数呼び出し:
SetJob(
mhPrinter,
midJob,
0,
IntPtr.Zero,
PrintJobControlCommands.JOB_CONTROL_PAUSE) 'Here exception is thrown
使用するスプーラ 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