zoukankan      html  css  js  c++  java
  • 回复 "Timer008" 的一个类型转换的问题 不是很典型, 对其他人参考价值不大

    问题来源: http://www.cnblogs.com/del/archive/2008/07/10/1239621.html#1250359

    代码文件:
    unit Unit1;
    
    interface
    
    uses
      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}
    
    {初始化测试数据}
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Edit1.Text := '004500FF';
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      a,b: Integer;
    begin
      {把 Edit1 中的十六进制字符串转换成整数}
      b := StrToIntDef('$' + Edit1.Text, 0);
      {通过汇编的方式把 b 赋给 a; 这相当于 a := b;}
      asm
        mov eax, b
        mov a, eax
      end;
      {看看 a 的值}
      ShowMessage(IntToHex(a, 8)); {004500FF}
    end;
    
    end.
    
    
    窗体文件:
    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
      end
    end
    
  • 相关阅读:
    大端小端
    浅谈协程
    boost总结之any
    boost总结之variant
    STL总结之functor
    zabbix设置多个收件人
    zabbix设置发送消息的时间
    zabbix利用微信报警
    Windos无法验证文件数组签名
    zabbix基础安装
  • 原文地址:https://www.cnblogs.com/del/p/1239796.html
Copyright © 2011-2022 走看看