Click here to Skip to main content
16,004,882 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerCross post. Please ignore this thread. Pin
Pete O'Hanlon7-Nov-07 1:45
mvePete O'Hanlon7-Nov-07 1:45 
GeneralRe: Cross post. Please ignore this thread. Pin
Paul Conrad7-Nov-07 12:17
professionalPaul Conrad7-Nov-07 12:17 
AnswerRe: MSI Package Pin
#realJSOP7-Nov-07 3:31
professional#realJSOP7-Nov-07 3:31 
GeneralRe: MSI Package Pin
Paul Conrad7-Nov-07 12:18
professionalPaul Conrad7-Nov-07 12:18 
GeneralRe: MSI Package Pin
Justin Perez10-Nov-07 5:36
Justin Perez10-Nov-07 5:36 
QuestionExporting Crystal Report in PDF with Textboxes in PDF Pin
Mayank Prajapati6-Nov-07 16:50
Mayank Prajapati6-Nov-07 16:50 
NewsSync Framework CTP released Pin
brucedkyle6-Nov-07 8:25
brucedkyle6-Nov-07 8:25 
QuestionHow to locate a delegate in a running, foreign assembly Pin
redWingBB6-Nov-07 6:30
redWingBB6-Nov-07 6:30 
I have a remoting utility, with three assemblies
Top or TopService, Listener, Worker

Top is a Forms app, TopService is a windows service
The reason for this is so installers can get running as an app, then deploy as a service

Top has a Print member which prints to its form.text box
TopService also has a Print member which prints to an error log
Both have a Reference to Listener, and they each create it as
Listener listen = new Listener(Print)

Listener has a delegate, which is set either to Top.Print or TopService.Print in its constructor
It then starts the remoting system with Worker as a SingleCall remoted class
public Listener(PrintCallback _print)
{
m_printDelegate = _print;
RemotingConfiguration.Configure("Worker.dll.config");
}

When Remoting fires, and Worker is instantiated, I need to locate the in memory Listener, then within Listener locate its m_printDelegate, to call through it with messages.
My intent is that Top, the Forms App, will display messages in its text box, and TopService, the Windows Service, will log messages in a log file.

What I have tried, that seems ever so close, is this kind of thing;

const string listener = "Listener";

//Get all the loaded assemblies in this domain
Assembly[] asmArr = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly asm in asmArr)
{
//Get the modules of each assembly
Module[] modules = asm.GetModules();

//Check to see if module name starts with "Listener"
string mName = asm.GetName().ToString();
if (listener.CompareTo(mName.Substring(0, listener.Length)) == 0)
{
//Found the in memory Listener, now locate its m_printDelegate

//This doesnt work - type is System.Reflection and all the members
//of that base class seem to be whats returned in GetMembers
Module m = modules[0];
Type mt = m.GetType();
foreach(MemberInfo x in mt.GetMembers())
{
s = x.ToString();
}
//Same with this
//Also tried similar approaches with the module itself
foreach (MethodInfo x in mt.GetMethods())
{
s = x.ToString();
}

}
}







Bill in PA/USA

QuestionWhat's the best way serialize .Net 2.0 WinForms (the actual form, not the data)? Pin
johnbMA5-Nov-07 13:01
johnbMA5-Nov-07 13:01 
QuestionC# .Net Framework classes Soap XML Pin
AssemblySoft5-Nov-07 6:17
AssemblySoft5-Nov-07 6:17 
Answeranother cross-post Pin
Luc Pattyn5-Nov-07 6:41
sitebuilderLuc Pattyn5-Nov-07 6:41 
GeneralRe: another cross-post Pin
Paul Conrad7-Nov-07 12:19
professionalPaul Conrad7-Nov-07 12:19 
QuestionC++ code from the microsoft visual study Pin
Knowledgestudent4-Nov-07 23:33
Knowledgestudent4-Nov-07 23:33 
AnswerRe: C++ code from the microsoft visual study Pin
led mike5-Nov-07 7:16
led mike5-Nov-07 7:16 
AnswerRe: C++ code from the microsoft visual study Pin
Luc Pattyn5-Nov-07 7:40
sitebuilderLuc Pattyn5-Nov-07 7:40 
AnswerRe: C++ code from the microsoft visual study Pin
#realJSOP7-Nov-07 2:57
professional#realJSOP7-Nov-07 2:57 
Questionhow to recognize an assembly Pin
mukkanti0074-Nov-07 19:53
mukkanti0074-Nov-07 19:53 
AnswerRe: how to recognize an assembly Pin
DavidNohejl4-Nov-07 22:18
DavidNohejl4-Nov-07 22:18 
QuestionAn idea Pin
Strategic_Thinker3-Nov-07 0:46
Strategic_Thinker3-Nov-07 0:46 
AnswerRe: An idea Pin
Paul Conrad3-Nov-07 5:35
professionalPaul Conrad3-Nov-07 5:35 
JokeRe: An idea Pin
Luc Pattyn3-Nov-07 5:39
sitebuilderLuc Pattyn3-Nov-07 5:39 
JokeRe: An idea Pin
Paul Conrad3-Nov-07 5:49
professionalPaul Conrad3-Nov-07 5:49 
AnswerRe: An idea Pin
Vasudevan Deepak Kumar9-Nov-07 1:17
Vasudevan Deepak Kumar9-Nov-07 1:17 
QuestionCompiled code of VS 2005 to be run with VS 2003 application Pin
Cyber Friend2-Nov-07 23:17
Cyber Friend2-Nov-07 23:17 
AnswerRe: Compiled code of VS 2005 to be run with VS 2003 application Pin
pmarfleet2-Nov-07 23:50
pmarfleet2-Nov-07 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.