Hi I have a small problem I don't seem to manage very well. The thing is that I would like to retrive two instances of a program (two instances of the program are running) that is registered in the ROT.
The code I have used is this: private ArrayList GetObjectsFromROT() { ArrayList fireobj=new ArrayList(); string spatfire="!{ACEB76D0-2359-11D2-B125-006098C52C3F}"; UCOMIBindCtx bc; Ole32.CreateBindCtx ( 0, out bc ); UCOMIRunningObjectTable rot; bc.GetRunningObjectTable ( out rot ); UCOMIEnumMoniker enumMkr; rot.EnumRunning ( out enumMkr ); UCOMIMoniker[] elts = new UCOMIMoniker[1]; int cnt; int ret; while ( ( ret = enumMkr.Next ( 1, elts, out cnt ) ) >= 0 && ( cnt > 0) ) { string displayName;
object obj; elts[0].GetDisplayName ( bc, null, out displayName );
if(displayName==spatfire) { rot.GetObject(elts[0],out obj); if(obj!=null)fireobj.Add(obj); } } return fireobj; } The thing is that the rot.GetObject seems to return the same com-object all the time (the first?), but the Moniker seem to point to the right instance. How can I retrieve all instances? The thing is that I would like to be able to retrive an event from one of the programs, check a value and pass that value to the other instance of the program? Clear enough?
Thanx for any help...
Johan
_________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
=================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in:
2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet
Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet
View archives and manage your subscription(s) at http://discuss.develop.com