none
How can i read a value of a address memory? RRS feed

  • Question

  • How can i get/read the value of adress 0063FE94??

    for exemple: label1.text = H&0063FE94, but it return number in decimal, i dont want to convert this hex to decimal, i want the its value.

    thanks.

    Sunday, November 25, 2018 2:35 AM

All replies

  • Hi

    This may help.

    I first of all set a variable to the value of the Hex number to simulate what you must have. Then display that value as the Hex string you want (prefixed with "&H" (NOT "H&")

        Dim v As Long = &H63FE94
        ' = 6553236
    
        Dim s As String = "&H" & Hex(v).ToString
        ' OR
        Label1.text = "&H" & Hex(v).ToString


    Regards Les, Livingston, Scotland


    • Edited by leshay Sunday, November 25, 2018 12:45 PM
    Sunday, November 25, 2018 12:44 PM
  •  It is not clear what you want to actually do.  Are you actually trying to read something from the memory address at &H63FE94,  or are you just trying to display the hexadecimal value in the label?

     If you want to just display the hexadecimal value in a label,  then there are a few ways to do that.  Below is another example of doing that.

     However,  if you are actually trying to read some data that is stored in the memory at that address,  then we would need a lot more detail of how you are getting this memory address and what type of data is actually stored in the memory at that address.  Like a String,  Integer,  Double,  Byte,  or other data type.

     Anyways,  the below example will display 63FE94 in the label by using the hexadecimal format ("X").

    Label1.Text = &H63FE94.ToString("X") 'displays 63FE94
     

     If you want it displayed with 8 digits like 0063FE94 in the label,  you can specify the hexadecimal format to be displayed as 8 characters long like this...

    Label1.Text = &H63FE94.ToString("X8") 'displays 0063FE94


    If you say it can`t be done then i`ll try it

    • Edited by IronRazerz Sunday, November 25, 2018 6:55 PM
    Sunday, November 25, 2018 5:51 PM
  • See also: Marshal.ReadByte.


    Sunday, November 25, 2018 5:56 PM
  • You said:

    However,  if you are actually trying to read some data that is stored in the memory at that address,  then we would need a lot more detail of how you are getting this memory address and what type of data is actually stored in the memory at that address.  Like a String,  Integer,  Double,  Byte,  or other data type.

    ///////////////////////

    You're right, I want to do it, there is a int number in this address, i want to set  this value in a label.

    OBS: this address it's in another windows

    Monday, November 26, 2018 7:32 PM

  • You're right, I want to do it, there is a int number in this address, i want to set  this value in a label.

    OBS: this address it's in another windows

    You can assign the memory address to an IntPtr and use Marshal.ReadInt32 Method to retrieve the 32 bit integer value at that address.  There are similar methods available to read integer values of different sizes (i.e., 16 bit, 64 bit).  After you have read the value into an integer variable you will be able to convert the integer variable to a string and store the string in a label as shown in earlier posts.

    Of course this will only succeed if the memory address to be read is within your own process.

    Monday, November 26, 2018 7:50 PM

  • OBS: this address it's in another windows

     You did not answer my other question,  how are you getting the memory address from this other window?

     Is this integer actually displayed in a control that is on the other window?

     My suspicion is that you have a handle to a control on the other window that is displaying the integer,  not a memory address to an integer that was written to the memory.  If that is so,  then you need to use the GetWindowText api function,  or the SendMessage api function along with the WM_GETTEXT windows message.  However, it may require other steps with some controls.


    If you say it can`t be done then i`ll try it

    • Edited by IronRazerz Monday, November 26, 2018 9:29 PM
    Monday, November 26, 2018 9:23 PM