Jump to content
Tuts 4 You

Set an operand to MessageBox.Show()?


MindSystem

Recommended Posts

Hi, i want to set an operand to MessageBox.Show("test");

But when i debug, using this code : 

method.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Ldstr, "test"));
                            object a = MessageBox.Show(method.Body.Instructions[0].Operand.ToString());
                            method.Body.Instructions.Insert(1, Instruction.Create(OpCodes.Nop));
                            method.Body.Instructions.OpCode = OpCodes.Call;
                            method.Body.Instructions.Operand = a; 

(Yeah the code is strange haha)

So, when i debug using this code, it shows messagebox unlimited...;

My Question is : how to set an operand to MessageBox.Show without get messagebox?


Thanks you ;)

Link to comment

Create a new projet & on button1_click event put a M'essagebox show' then build it up and then decompile it. You will see what's missing from your code

Edited by XenocodeRCE
  • Like 1
Link to comment
2 hours ago, XenocodeRCE said:

Create a new projet & on button1_click event put a M'essagebox show' then build it up and then decompile it. You will see what's missing from your code

Yeah, i forgot the "pop" opcode 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...