Results 1 to 4 of 4

Thread: Delphi ทำยังไงถึงจะได้ ค่า Key ใน Registry

  1. #1
    Member
    Join Date
    Dec 2004
    Location
    Thailand
    Posts
    30


    Delphi ทำยังไงถึงจะได้ ค่า Key ใน Registry

    คือ ผมมีปัญหา กับ key ในRegistry ครับ
    ผมติดต่อกับ Registry และนำค่า ออกมาได้แล้ว แต่ ติดที่ ว่าใน Key หนึ่งมันมีค่าได้หลายค่า
    แล้วก็ใน Key 1 Key เองก็มี Key ซ้อนกันอยู่
    เลยอยากถามว่าจะทำยังไงให้ได้ค่า Key และค่าที่อยู่ใน Key แต่ละตัวออกมา
    เช่น ใน HKey_LOCAL_MACHINE จะมี Key ย่อย อีก เช่น SOFTWARE
    ในค่า Key SOFTWARE ก็มีอีกหลาย Key ถามว่า Delphi จะเอาค่า Key ทั้งหมดใน
    HKey_LOCAL_MACHINESOFTWARE ออกมาได้ยังไงครับ

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Thailand
    Posts
    211


    Re: Delphi ทำยังไงถึงจะได้ ค่า Key ใน Registry

    คล้ายๆแบบนี้ป่าว

    program Project1;

    {$APPTYPE CONSOLE}

    uses
    windows;

    function str2int(x:string):integer;
    var v,code:integer;
    begin
    val(x,v,code);
    str2int:=v;
    end;


    function EnumKeys(kkey,kpth:string):string;
    var
    K: HKey;
    I: Integer;
    L: DWORD;
    S: string;
    B: string;
    Vals: Array[0..255] of Char;
    begin

    case str2int(kkey) of
    1: RegOpenKey(HKEY_CLASSES_ROOT, PChar(kpth), K);
    2: RegOpenKey(HKEY_CURRENT_USER, PChar(kpth), K);
    3: RegOpenKey(HKEY_LOCAL_MACHINE, PChar(kpth), K);
    4: RegOpenKey(HKEY_USERS, PChar(kpth), K);
    5: RegOpenKey(HKEY_CURRENT_CONFIG, PChar(kpth), K);
    6: RegOpenKey(HKEY_DYN_DATA, PChar(kpth), K);
    end;

    SetString(S, nil, 255);
    I:=0; B:='';
    while RegEnumKey(K,I,PChar(S),255) <> ERROR_NO_MORE_ITEMS do begin

    B:=B+''+PChar(S)+#13#10;

    Inc(I);
    end;
    Result := string(;
    end;

    begin

    writeln(EnumKeys('3','software'));
    readln;

    end.


    ถ้าอยากได้แบบ
    ลึกกว่านี้อีกก็ลองคิดต่อเอง ผมเองก้อไม่ค่อยเก่งซะด้วย

  3. #3
    Junior Member
    Join Date
    Apr 2008
    Posts
    11


    **Hidden Content: To see this hidden content your post count must be 5 or greater.**

  4. #4
    Member
    Join Date
    Mar 2008
    Location
    Gifted Computer S.W.K ChiangRai
    Posts
    30


    ผมจะเอา Delphi ดูค่า Registry ของ WinguardPro
    I'm Gifted Computer SWK.

Similar Threads

  1. Replies: 1
    Last Post: 04-05-2009, 10:41 AM
  2. Delphi Tip
    By yougubget in forum Delphi,Pascal
    Replies: 0
    Last Post: 28-02-2009, 01:52 PM
  3. Replies: 0
    Last Post: 28-12-2008, 12:00 AM
  4. มารู้จักคีย์หลักของ Registry และ ชนิดของข้อมูล Registry
    By DoctorHacker in forum บทความ คอมพิวเตอร์ ทัวไป
    Replies: 0
    Last Post: 18-07-2008, 08:48 PM
  5. Replies: 0
    Last Post: 02-10-2007, 07:46 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

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