Access to the registry key 'Global' is denied
I'm using Visual C# 2005 Express to write a program that checks for available RAM.
The partial code is as below:
using
System;using System.Collections.Generic;
using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;using
System.Diagnostics;namespace
MyTests{
publicpartialclassForm1 :Form
{
public Form1()
{
InitializeComponent();
}
privatevoid buttonCheckRam_Click(object sender,EventArgs e)
{
PerformanceCounter ramCounter =newPerformanceCounter("Memory","Available MBytes");
MessageBox.Show(ramCounter.NextValue() +"MB");
}
}
}
Upon running the program as Administrator, there was no problem, but when I run the program as a normal user, it
throws an "UnauthorizedAccessException" , Acess to the registry key 'Global' is Denied.
Any ideas, how to solve this problem is much appreciated.
Paul

