Problem Source: http://www.cnblogs.com/del/archive/2008/07/10/1239621.html#1250359
CodeFile:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) edit1: tedit; button1: tbutton; procedure formcreate (Sender: tobject); Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} {initialize test data} procedure tform1.formcreate (Sender: tobject); begin edit1.text: = '004500ff '; end; Procedure tform1.button1click (Sender: tobject); var A, B: integer; begin {convert the hexadecimal string in edit1 to an integer} B: = strtointdef ('$' + edit1.text, 0); {assign B to a by means of assembly; this is equivalent to a: = B;} ASM mov eax, B mov A, eax end; {Look at the value of a} showmessage (inttohex (A, 8); {004500ff} end; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 206 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object edit1: tedit left = 104 Top = 56 width = 121 Height = 21 taborder = 0 text = 'edit1' end object button1: tbutton left = 128 Top = 112 width = 75 Height = 25 caption = 'button1' taborder = 1 onclick = button1click endend