By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,677 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,677 IT Pros & Developers. It's quick & easy.

SystemMonitor ActiveX control and custom performance counters

P: n/a

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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.