470,616 Members | 2,260 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,616 developers. It's quick & easy.

SystemMonitor ActiveX control and custom performance counters

I have the SystemMonitor ActiveX control on a form and I try to register a custom performance counter.
I expect that after registering the counter with the OS, the user would be able to add it through
this System Monitor ActiveX control on the form.
Yet, the Add dialog of this ActiveX does NOT contain the already registered counter.
Does anyone know what might be wrong?
Code snippet follows at the end.
BTW if I have the code that registers the counter in a separate executable, then the ActiveX has my
counter. But if they're in one and the same executable, the ActiveX doesn't have it !?!


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;

namespace WindowsApplication1
public class Form1 : System.Windows.Forms.Form
private AxSystemMonitor.AxSystemMonitor axSystemMonitor1;
private System.ComponentModel.Container components = null;

static void Main()
CounterCreationDataCollection CCDC = new CounterCreationDataCollection();
CounterCreationData ccd = new CounterCreationData(
"Some Help",
CCDC.Add( ccd );
if (PerformanceCounterCategory.Exists("MyCategoryName ") )
PerformanceCounterCategory.Delete("MyCategoryName" );
PerformanceCounterCategory.Create("MyCategoryName" , "Some Help", CCDC);

Application.Run(new Form1());

public Form1()

protected override void Dispose( bool disposing )
if( disposing )
if (components != null)
base.Dispose( disposing );

#region Windows Form Designer generated code
private void InitializeComponent()
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.axSystemMonitor1 = new AxSystemMonitor.AxSystemMonitor();
((System.ComponentModel.ISupportInitialize)(this.a xSystemMonitor1)).BeginInit();
this.axSystemMonitor1.Enabled = true;
this.axSystemMonitor1.Location = new System.Drawing.Point(0, 0);
this.axSystemMonitor1.Name = "axSystemMonitor1";
this.axSystemMonitor1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axSystemMonitor1.OcxState")));
this.axSystemMonitor1.Size = new System.Drawing.Size(328, 272);
this.axSystemMonitor1.TabIndex = 0;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(344, 269);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.a xSystemMonitor1)).EndInit();

Nov 17 '05 #1
0 2594

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by David Mitchell | last post: by
reply views Thread by Christopher Attard | last post: by
7 posts views Thread by James | last post: by
3 posts views Thread by Weston Fryatt | last post: by
6 posts views Thread by Budhi Saputra Prasetya | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.