|
-
April 15th, 2008, 09:56 AM
#1
Access is denied error when calling destroywindow
I am getting an access is denied error message when calling the DestroyWindow() function in a .net windows application, here is the code:
ArrayList RunningP;
Process IEProc;
Int32 temp;
Int32 i = 0;
Boolean b;
RunningP = new ArrayList(Process.GetProcessesByName("iexplore"));
if (RunningP.Count > 0)
{
IEProc = (Process)RunningP[i];
b = DestroyWindow(IEProc.Handle);
i = i + 1;
temp = GetLastError();
}
the variable temp is where i find error code 5 which is access is denied. I also have these delegate methods defined on this page:
[DllImport("User32.dll")]
public static extern System.Boolean DestroyWindow(IntPtr hWnd);
[DllImport("kernel32.dll")]
public static extern System.Int32 GetLastError();
I am logged on as local administrator, so not sure what is causing this error message I have search on this site and others and cant seem to find a fix for this, can anyone help?
Regards
Joe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|