Groups | Blog | Home
all groups > vb.net > october 2005 >

vb.net : Anyone ever seen this "System.ComponentModel.Win32Exception: Access is denied Exception."


Microsoft News
10/31/2005 6:28:58 PM
I have a program that is printing PDFs and to check that the PDF is complete
we run the following code after we are done printing.

lpsProcesses = Process.GetProcesses

For Each lpsProcess In lpsProcesses
If lpsProcess.ProcessName.CompareTo("Acrobat") = 0 Then
lpsProcess.Close()
End If
Next

Now this works great on most of my users computer. But on some users
computers, all at the same company, on the same domain, etc. this code
generates the following error:

System.ComponentModel.Win32Exception: Access is denied
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32
access, Boolean throwIfExited)
at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId)
at System.Diagnostics.Process.get_Modules()
at System.Diagnostics.Process.get_MainModule()
at System.Diagnostics.Process.get_ProcessName()
at ActNotesMod.frmPreview.PrintPA(IPDFPrinter pobjPrinter, Boolean
pbUseDefaultPrinter, String psPrinterName)
at ActNotesMod.frmActNotes.OutputPDF(Boolean pbPrint)

It is my belief that the problem is some type of rights issue with some
process that I do not know. Anyone out there that knows what a user has to
have rights to in order to run this code and use the "System.Diagnostics"
object?

The file they are printing is in their Document and Settings folder so they
have full access. They are network users so they are not admins on the
computers.

Any help would be GREAT!!!!!!!!!!

Clyde

tomb
11/1/2005 9:51:48 AM
See below:

[quoted text, click to view]
I would double check this - just because they are network users doesn't
necessarily mean they aren't in the administrators group on their pc.
Maybe some are and some aren't, and the ones that aren't are having the
problems.

Tom

[quoted text, click to view]
Microsoft News
11/1/2005 7:44:15 PM
Tom

I will check that but does a user have to have admin privileges in order to
use the Process Object?

Clyde
[quoted text, click to view]

tomb
11/2/2005 4:49:31 PM
That I'm not sure of - sorry.

T

[quoted text, click to view]
AddThis Social Bookmark Button