Offset as hex from textbox
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 ^_)
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.
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.
精彩评论