CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009

    System.Diagnostics.Process (MainModule throws Wind32 "Access Denied" exception)


    I'm trying to thumb through the list of currently running processes and search their descriptions

    Here is how I get the list of processes:

    Process[] pList = System.Diagnostics.Process.GetProcesses();

    Here is where the description is located:

    System.Diagnostics.Process foobarProcess;
    foobarProcess.MainModule.FileVersionInfo.FileDescription; //String value

    However, when I try to access anything under the MainModule property, i get a Win32 exception saying "Access Denied".

    textBlock.Text = foobarProcess.MainModule.FileVersionInfo.FileDescription.ToLower();

    I'm a noob, any help?

    Last edited by Kipp27; May 20th, 2009 at 12:10 AM.

  2. #2
    Join Date
    Jun 2004
    Kashmir, India

    Re: System.Diagnostics.Process (MainModule throws Wind32 "Access Denied" exception)

    There are some processes that run under System account. The ones that run under system account would not be accessible. So it is better to wrap your code in a try catch block.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.