请教注册表中Dword值如何转换为String?(0分)

A

awfigsk

Unregistered / Unconfirmed
GUEST, unregistred user!
如何将注册表中DWORD值原样放入LISTVIEW或ListBox或Edit或Memo等TString控件呢?
例:
在注册表中: THreads REG_DWORD 0×00000003(3)
现要放入一个ListView控件中,怎样才能将0×00000003(3)放入呢?是不是要将
Integer型 3 转换为十六制?再添加‘0’?
谢谢!
 
很简单,如果想把整型以十六进制字符形式保留,在delphi中有这个函数可作转换:
function IntToHex(Value: Integer
Digits: Integer): string

function IntToHex(Value: Int64
Digits: Integer): string;

delphi的例子如下:

[blue]//The following example uses an edit control, a button, and a label on a form. When the button is clicked, the hexadecimal value of each character in the edit control is displayed in the label.[/blue]
procedure TForm1.Button1Click(Sender: TObject);

var
i: Integer;
begin
Label1.Caption := '';
for i := 1 to Length(Edit1.Text) do
begin
try
Label1.Caption := Label1.Caption + IntToHex(Edit1.Text,2) + ' ';
except
Beep;
end;
end;
end;
 
十分感谢!
 
顶部