Q&A

  • 설치된 소프트웨어가지고 오는 소스인데 실행에서 에러가..나요 좀 봐주세요
//나름데로 여기저기 물어보면서 비베소스를 델파이로 바꿨는데 실행이 안되요..
procedure TfrmMain.ScanPC_GetSwrINFO;
var
  GetRegValue: String;
  IRETVAL: Integer;
  IRETVAL2: Integer;
  PHKey: HKEY;
  PHKey2: HKEY;
  vValue: String;
  sz: PDWORD;

  fKeyIndex: Cardinal;
  fKeyName: String;
  fKeyLen: Cardinal;
  fClassName: String;
  fClassLen: PDWORD;
  fLastWrite: PFileTime;

  dwType: PDWORD;
begin

  GetRegValue := '';
  IRETVAL := regOpenKeyEx(HKEY_LOCAL_MACHINE, 'SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONUNINSTALL', 0, KEY_ENUMERATE_SUB_KEYS, PHKey);
  fKeyIndex := 0;

  while (IRETVAL <> 0) do
  begin
        SetString(fKeyName, nil, 255);
        SetString(fClassName, nil, 255);
        fKeyLen   := 255;
        fClassLen^ := 255;
        IRETVAL := regEnumKeyEx(PHKey, fKeyIndex, PChar(fKeyName), fKeyLen, nil, PChar(fClassName), fClassLen, fLastWrite);

        if IRETVAL <> 0 then
        begin
            fKeyName   :=copy(fKeyName,1,fKeyLen);
            fClassName :=copy(fClassName,1,fClassLen^);

            sz^ := 256;
            SetString(vValue, nil, 256);
            IRETVAL2 := RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONUNINSTALL' + fKeyName), 0, KEY_ALL_ACCESS, PHKey2);
            IRETVAL2 := RegQueryValueEx(PHKey2, 'DisplayName', 0, dwType, PByte(vValue), sz);
            if IRETVAL2 = 0 Then
            begin
                GetRegValue := copy(vValue,1, sz^ - 1);
                listHw.Items.Add(vValue);
            end;
            RegCloseKey (PHKey2);
        end;
        fKeyIndex := fKeyIndex + 1;
  end;
    RegCloseKey (PHKey);
end;
2  COMMENTS
  • Profile
    허진 2003.08.20 00:36
    procedure TfrmMain.ScanPC_GetSwrINFO;
    var
      GetRegValue: String;
      IRETVAL:     Integer;
      IRETVAL2:    Integer;
      PHKey:       HKEY;
      PHKey2:      HKEY;
      vValue:      String;
      sz:          Cardinal;

      fKeyIndex:   Cardinal;
      fKeyName:    String;
      fKeyLen:     Cardinal;
      dwType:      Cardinal;
    begin

      GetRegValue := '';
      IRETVAL := regOpenKeyEx(HKEY_LOCAL_MACHINE, 'SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONUNINSTALL', 0, KEY_ENUMERATE_SUB_KEYS, PHKey);
      fKeyIndex := 0;

      while (IRETVAL = 0) do
      begin

            SetString(fKeyName, nil, 255);
            fKeyLen   := 255;
            IRETVAL := regEnumKeyEx(PHKey, fKeyIndex, PChar(fKeyName), fKeyLen, nil, nil, nil, nil);

            if IRETVAL = 0 then
            begin
                fKeyName   :=copy(fKeyName,1,fKeyLen);

                SetString(vValue, nil, 255);
                sz := 255;

                IRETVAL2 := RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWAREMICROSOFTWINDOWSCURRENTVERSIONUNINSTALL' + fKeyName), 0, KEY_ALL_ACCESS, PHKey2);
                IRETVAL2 := RegQueryValueEx(PHKey2, PChar('DisplayName'), nil, @dwType,PByte(vValue),@sz);
                if IRETVAL2 = 0 Then
                begin
                    ListSw.Items.Add(vValue);
                end;
                RegCloseKey (PHKey2);
            end;
            fKeyIndex := fKeyIndex + 1;
      end;
        RegCloseKey (PHKey);
    end;
  • Profile
    데빌카마라 2003.08.20 07:20
    제가 확인해 봤는데 에러는 없는거 같습니다

    아마 이부분이 버튼으로 본다면

    procedure TfrmMain.ScanPC_GetSwrINFO;

    다음으로 바꿔보세요..(그리고 uses절에 registry추가 하시는거 잊지마시구여)

    procedure TfrmMain.ScanPC_GetSwrINFOClick(Sender: TObject);

    그럼 즐코하시구여...