delphi教程

Delphi在Vista下读取注册表

位置:首页 > delphi教程 > 高级教程,2013-03-22
Delphi在Vista下读取注册表functiongetcpu:PChar;stdcall;varreg:HKEY;size:PDWORD;info:PByte;beginGetMem(info,6...

Delphi在Vista下读取注册表
                  function getcpu:PChar;stdcall;
                  var
                    reg:HKEY;
                    size:PDWORD;
                    info:PByte;
                  begin
                    GetMem(info,64);
                    GetMem(size,SizeOf(pdword));
                    size^:=64;
                   
                  RegOpenKeyEx(HKEY_LOCAL_MACHINE,PChar('HARDWARE\DESCRIPTION\System\CentralProcessor\0'),0,KEY_QUERY_VALUE,reg);
                   
                  RegQueryValueEx(reg,PChar('ProcessorNameString'),nil,nil,Pbyte(info),@Size);
                    Result:=PChar(info);
                    RegCloseKey(reg);
                  end;

                  procedure TForm1.Button1Click(Sender: TObject);
                  begin
                    ShowMessage(getcpu);
                  end;  

TAGS:Delphi读取注册表

猜你喜欢

NewHot