R
RickDee
Hi. I need help badly here.
I need to write a program to invoke methods ( static, public, nonstatic,
with parameters, and etc ) from an exe file, but I keep facing problem.
From all the notes that I read from internet, I realized that InvokeMember
works for methods in class, but not when I have an exe ( right ?).
My program looks like this :
using System.Reflection;
Assembly testAssembly = null;
Form testForm = null;
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance ;
static void RunApp (object state)
{
Application.Run((Form)state);
}
private void InvokeMethod (Form form, string methodName, params object[]
parms)
{
EventHandler eh =
(EventHandler)Delegate.CreateDelegate(typeof(EventHandler), form,
methodName);
if (eh!=null)
{
form.invoke (eh, parms);
}
}
private void button1_Click (object sender, System.EventArgs e)
{
}
I need to write a program to invoke methods ( static, public, nonstatic,
with parameters, and etc ) from an exe file, but I keep facing problem.
From all the notes that I read from internet, I realized that InvokeMember
works for methods in class, but not when I have an exe ( right ?).
My program looks like this :
using System.Reflection;
Assembly testAssembly = null;
Form testForm = null;
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance ;
static void RunApp (object state)
{
Application.Run((Form)state);
}
private void InvokeMethod (Form form, string methodName, params object[]
parms)
{
EventHandler eh =
(EventHandler)Delegate.CreateDelegate(typeof(EventHandler), form,
methodName);
if (eh!=null)
{
form.invoke (eh, parms);
}
}
private void button1_Click (object sender, System.EventArgs e)
{
}