Click here to Skip to main content
15,920,503 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataBase Problem Pin
VenkatFor.NET11-Aug-04 7:07
VenkatFor.NET11-Aug-04 7:07 
GeneralProblem verifying a signed XML document Pin
pelos11-Aug-04 1:15
pelos11-Aug-04 1:15 
GeneralJodoveepn article printing controls on a form Pin
robmays11-Aug-04 1:07
robmays11-Aug-04 1:07 
QuestionHow to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 0:20
sachinkalse11-Aug-04 0:20 
AnswerRe: How to access the object associated with tree nodes tag property? Pin
Nick Parker11-Aug-04 2:59
protectorNick Parker11-Aug-04 2:59 
GeneralRe: How to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 14:55
sachinkalse11-Aug-04 14:55 
GeneralRe: How to access the object associated with tree nodes tag property? Pin
sachinkalse11-Aug-04 16:30
sachinkalse11-Aug-04 16:30 
GeneralPointers,Classes,Objects... II Pin
Tambi Ashmoz11-Aug-04 0:15
Tambi Ashmoz11-Aug-04 0:15 
How can I get a variable pointer (as IntPtr) ?


I am trying to compare between two objects, the objects are not the same but they could be from some place ...

Example - let say we have two classes one derived from another ...

public class A
{
  protected h=0;

  public virtual func()
  {
   h=0;
  }
}

public class B:A
{
  public override func()
  {
   h=1;
  }
}

Now ... I'am creating the objects ...

obj1=Activator.CreateInstance(t1); //Type t1; class A
c.Invoke(obj1,null); //ConstructorInfo c; getting constructor from class A

the same with the other class...

obj1=Activator.CreateInstance(t2); //Type t2; class B
c.Invoke(obj2,null); //ConstructorInfo c; getting constructor from class B


From this point you can see in the debugger obj1,obj2 (with the variable h=0 in both)
Now I'am invoking my function...

//MethodInfo m1,m2; getting my virtual AND override functions each from it's class ... and after that running functions , with null as parametter...

object []parametersForFunction=new object[m1.GetParameters().Length];
//m1 or m2 doesn't matter they have the same parameters... virtual,override

m1.Invoke(obj1,parametersForFunction);
m2.Invoke(obj2,parametersForFunction);

I can't check "h" with the GetFields() couse its not public()..
My problem is here...

Now if wee go back to the debugger we can see that in obj1.h=0 and obj2.h=1
Somthing like this
obj1.A.h=0
obj2.B.A.h=1

My idea was to try the Marshal.ReadIntPtr(IntPtr,offset) so I can read obj2 after some offset, So I needed my variable Address. (somehow even in unsafe we cant do object *p=obj1; on objetcs...)

I tried Marshel.ReadByte and it's not working cause my object type could be anything...


Anyone have some idea ???

Thanks




GeneralRe: Pointers,Classes,Objects... II Pin
Werdna11-Aug-04 13:45
Werdna11-Aug-04 13:45 
GeneralRe: Pointers,Classes,Objects... II Pin
Tambi Ashmoz11-Aug-04 18:54
Tambi Ashmoz11-Aug-04 18:54 
GeneralRe: Pointers,Classes,Objects... II Pin
Werdna12-Aug-04 2:26
Werdna12-Aug-04 2:26 
GeneralCreating the Spyware Pin
softp_vc10-Aug-04 23:35
softp_vc10-Aug-04 23:35 
GeneralRe: Creating the Spyware Pin
Colin Angus Mackay11-Aug-04 0:52
Colin Angus Mackay11-Aug-04 0:52 
GeneralRe: Creating the Spyware Pin
exhaulted11-Aug-04 1:21
exhaulted11-Aug-04 1:21 
GeneralRe: Creating the Spyware Pin
softp_vc11-Aug-04 1:35
softp_vc11-Aug-04 1:35 
GeneralRe: Creating the Spyware Pin
exhaulted11-Aug-04 1:56
exhaulted11-Aug-04 1:56 
GeneralRe: Creating the Spyware Pin
softp_vc11-Aug-04 2:08
softp_vc11-Aug-04 2:08 
GeneralRe: Creating the Spyware Pin
Nick Parker11-Aug-04 2:53
protectorNick Parker11-Aug-04 2:53 
GeneralRe: Creating the Spyware Pin
softp_vc11-Aug-04 2:57
softp_vc11-Aug-04 2:57 
GeneralRe: Creating the Spyware Pin
Nick Parker11-Aug-04 4:35
protectorNick Parker11-Aug-04 4:35 
GeneralRe: Creating the Spyware Pin
Dave Kreskowiak11-Aug-04 5:34
mveDave Kreskowiak11-Aug-04 5:34 
GeneralRe: Creating the Spyware Pin
Name Removed11-Aug-04 6:08
Name Removed11-Aug-04 6:08 
QuestionExtract outlook/exchange email attachments? Pin
Swaity10-Aug-04 22:22
Swaity10-Aug-04 22:22 
Generalopen an uploaded file Pin
tzewei10-Aug-04 21:59
tzewei10-Aug-04 21:59 
QuestionHow to launch a program at the end of an MSI installation? Pin
kmeads10-Aug-04 20:51
kmeads10-Aug-04 20:51 

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.