Question

I'm using lpBaseAddress : IntPtr

but ... I need to enter hex value :-/ like a normal offset

like on VB that could be something like :

offset = CLng("&H" + text)

So I need to take a value from textbox and make same magic on C# (or Nemerle ^_)

Was it helpful?

Solution

If you just want to parse hex:

string hex = "0a12cc";
long ptr = Convert.ToInt64(hex, 16);
IntPtr newPtr = new IntPtr(ptr);

I've used long here for illustration, as IntPtr could be 32/64.

OTHER TIPS

offset = System.Convert.ToInt64(this.yourTextBox.Text, 16);

Are you sure you need an Int64 (Long) and not just an Int32 (Int)? If you're a VB6 coder, Int32 (Int) is what you're looking for, not Long.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top