Steven-Devry
asked on
System.ComponentModel.Win32Exception: Access is denied
this is the error i get when i run the piece of code below on some machines:
System.ComponentModel.Win3 2Exception : Access is denied
at System.Diagnostics.Process Manager.Op enProcess( Int32 processId,
Int32 access, Boolean throwIfExited)
at System.Diagnostics.NtProce ssManager. GetModuleI nfos(Int32
processId)
at System.Diagnostics.Process .get_Modul es()
at System.Diagnostics.Process .get_MainM odule()
at System.Diagnostics.Process .get_Proce ssName()
at ExcelDemo.clsExcelHost..ct or() in D:\Bert Opdracht\Excel Demo for
Windows XP version\ExcelDemo\Classes\ clsExcelHo st.vb:line 13
at ExcelDemo.DataBaseSelectFo rm.MAcroRe fresh(Stri ng inputworkbook) in
the code that causes this is the following code
Dim process1() As System.Diagnostics.Process = System.Diagnostics.Process .GetProces ses()
xlApp = CreateObject("Excel.Applic ation")
Dim process2() As System.Diagnostics.Process = System.Diagnostics.Process .GetProces ses()
Dim ct1 As Integer
Dim ct2 As Integer
Dim blnUnique As Boolean
this is the line where the error is called on For ct1 = 0 To process1.GetUpperBound(0)
If process2(ct1).ProcessName = "EXCEL" Then
blnUnique = True
For ct2 = 0 To process1.GetUpperBound(0)
If process1(ct2).ProcessName = "EXCEL" Then
If process2(ct1).Id = process1(ct2).Id Then
blnUnique = False
Exit For
End If
End If
Next
If blnUnique = True Then
procId = process2(ct1).Id
Exit For
End If
End If
If somebody can give me a clue why this is happening i would be
very thankfull
Steven Devry
System.ComponentModel.Win3
at System.Diagnostics.Process
Int32 access, Boolean throwIfExited)
at System.Diagnostics.NtProce
processId)
at System.Diagnostics.Process
at System.Diagnostics.Process
at System.Diagnostics.Process
at ExcelDemo.clsExcelHost..ct
Windows XP version\ExcelDemo\Classes\
at ExcelDemo.DataBaseSelectFo
the code that causes this is the following code
Dim process1() As System.Diagnostics.Process
xlApp = CreateObject("Excel.Applic
Dim process2() As System.Diagnostics.Process
Dim ct1 As Integer
Dim ct2 As Integer
Dim blnUnique As Boolean
this is the line where the error is called on For ct1 = 0 To process1.GetUpperBound(0)
If process2(ct1).ProcessName = "EXCEL" Then
blnUnique = True
For ct2 = 0 To process1.GetUpperBound(0)
If process1(ct2).ProcessName = "EXCEL" Then
If process2(ct1).Id = process1(ct2).Id Then
blnUnique = False
Exit For
End If
End If
Next
If blnUnique = True Then
procId = process2(ct1).Id
Exit For
End If
End If
If somebody can give me a clue why this is happening i would be
very thankfull
Steven Devry
ASKER
The difference between the machines in one case is the oparating system.
For the Pc having Windows XP , the code is running fine.
Fot the PC where the operating system is Windows 2000, thr code is failing.
The only difference for the rest is, that the one Pc is a laptop and the other
PC is a desktop.
But that doesn't seem relevant to me.
For the rest the user rights are both identical
For the Pc having Windows XP , the code is running fine.
Fot the PC where the operating system is Windows 2000, thr code is failing.
The only difference for the rest is, that the one Pc is a laptop and the other
PC is a desktop.
But that doesn't seem relevant to me.
For the rest the user rights are both identical
Well the system that it ran fine on for me is using Windows 2000.
I'm wondering if this is related to the other access denied problem you posted about.
What is line 13 of "D:\Bert Opdracht\Excel Demo for Windows XP version\ExcelDemo\Classes\ clsExcelHo st.vb?"
I'm wondering if this is related to the other access denied problem you posted about.
What is line 13 of "D:\Bert Opdracht\Excel Demo for Windows XP version\ExcelDemo\Classes\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Could you tell us some more about the computers this is working on vs. the computers it isn't working on?