Dynamic Invoke of Sysmon.OCX Member "AddCounter" via reflection/interop failsWhen im Installing powe

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,<br/>
<br/>
running this code to set a property on the hosted Sysmon.ocx ActiveX control and calling a parameterless method works fine:<br/>
<br/>
<pre lang="x-c# using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Reflection;


namespace TestApplication
{
public partial class Form1 : Form
{
private AxHostingControl axHost;
private object ocxObject;

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
ocxObject.GetType().InvokeMember("DisplayProperties", BindingFlags.InvokeMethod, null, ocxObject, null);
}

private void Form1_Load(object sender, EventArgs e)
{
Application.OleRequired();
this.axHost = new AxHostingControl(Type.GetTypeFromProgID("Sysmon",true).GUID.ToString());
this.Controls.Add(this.axHost);
this.ocxObject = axHost.GetOcx();
}

private void button2_Click(object sender, EventArgs e)
{
ocxObject.GetType().InvokeMember("ShowToolbar", BindingFlags.SetProperty, null, ocxObject, new object[] { false });
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
this.axHost.Dispose();
}

private void button3_Click(object sender, EventArgs e)
{
object[] Parameters = new object[2];
Parameters[0] = "\Process(*)\% Processor Time";
Par


When im Installing powerpacks 10 i just get this error <.< OVER AND OVER AND OVER!!!<img src="http://social.microsoft.com/Forums/getfile/17877/" alt="

View the full article
 
Back
Top