Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: Buffer Edit Box

  1. #21
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Again whats "(buffer[$7fe0,[i]])" supposed to mean?

    its either buffer[$7fe0+i] or its buffer[i] .. you dont have a multi dimensional buffer, and [i] cant be used on its own.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  2. #22
    Join Date
    Jul 2007
    Posts
    42
    My brain is starting to bleed

    If I check one value in buffer offset $7fe0 using the code below it works
    Code:
    check := '36';
    for i := 0 to 1 do
    
    if (buffer[$7fe0+i]) = hextoint(check)+i then
    Showmessage ('Matched');
    if I try to check the whole string it doesn't showmessage ('Matched');

    Code:
    check := '363A3534000000004665622032332032';
    //check := '36';
    for i := 0 to 16 do
    
    if (buffer[$7fe0+i]) = hextoint(check)+i then
    Showmessage ('Matched');
    Code:
    function HexToInt(Hex: string): integer;
    var
      i: integer;
    begin
      Result := 0;
      case Length(Hex) of
        0: Result := 0;
        1..8: for i:=1 to Length(Hex) do
          Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
        else for i:=1 to 8 do
          Result := 16*Result + Pos(Upcase(Hex[i]), HexValues)-1;
      end;
    end;

  3. #23
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    It wont do

    because you're checking a value between 0 and 255 against.. well a VERY big number.. You would need to convert all the characters in the length of the string / 2 (eg 00-ff) and then smush them together so you end up with a string of the same lenght, and then compare it..

    OR

    Compare each chunk of 2 characters to the relevant spot on the way.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  4. #24
    Join Date
    Dec 2006
    Posts
    309
    Just wondering
    http://www.asmtrauma.com/OpenSourceLibs.htm
    http://www.asmtrauma.com/Details/ConvFact1.0.htm

    * DWORDToBinExact: Converts a 32-bit DWORD value to binary (Base 2) and puts the result in a buffer and then terminated the buffer with a null-byte. The binary bits put into the buffer include the zeros to the left of the number.
    * DWORDToBin: Does exactly what the "DWORDToBinExact" does but excludes zero bits to the left of the number.
    * DWORDToHexExact: Converts a 32-bit DWORD value to its equivalent hexadecimal (Base 16) notation and puts the result in a buffer. The result includes the nibbles to the left of the number that are equal to zero
    * DWORDToHex: Does the same as the "DWORDToHexExact" procedure but excludes the nibbles to the left of the number with the value of zero.
    * DWORDToStr: Converts an unsigned 32-bit value to a null-terminated string.
    * DWORDToOctExact: Converts a 32-bit DWORD value to Octal (Base 8) and puts the result in a buffer. The result includes the zeroes to the left of the converted number.
    * DWORDToOct: Does the exact same thing as the "DWORDToOctExact" does but excludes the zeroes to the left of the number from the result.
    * BinToDWORD: Converts a binary value (Base 2) inside a null-terminated string to a 32-bit numerical value (Base 10) and returns the result.
    * HexToDWORD: Converts a hexadecimal value (Base 16) inside a null-terminated string to a 32-bit numerical value (Base 10) and returns the result.
    * StrToDWORD: Converts an unsigned null-terminated string in the base of 10 to an unsigned 32-bit numerical value (Base 10) and returns the result.
    * OctToDWORD: Converts an octal value (Base 8) inside a null-terminated string to a 32-bit numerical value (Base 10) and returns the result.
    ,might help you a bit?

  5. #25
    Join Date
    Jul 2007
    Posts
    42
    Thanks Streamline

    If I ever work out how to make this little editor work properly I'll post the completed source files on the forum to help any other budding Delphi newbies who might be trying to write a similar program understand how to do it.

    The last time I programmed properly was back in the 80's in 6502 asm, I'm like the Austin Powers of the programming world

    LDX£$00
    .loop LDA $Editbox1.text,x
    STA$$6e00,x
    INX
    CPX £$04
    BNE .loop
    RTS

    That 6502 asm routine above is basically what I'm trying to achive in Delphi lol
    I only got into Delphi after watching the Buzz & Logan VTM tutorials so as I was saying to Liz, my knowledge of Delphi syntax is limited to what I've seen on the VTM's and from what I've read on delphibasics.co.uk
    Last edited by lda; 03-05-2008 at 07:00 AM.

  6. #26
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Take a read of my tutorial as well then :P
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  7. #27
    Join Date
    Dec 2006
    Posts
    309
    you know you could kinda cheat and use delphi's inline assembler

    Begin
    asm
    //do asm instructions here
    end;
    end;

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •