Edelson,

Tente o seguinte:

~~~~~~~~~~~~~~~~~~~~~~~~~
{
Usage:
VersionInformation(ListBox1)
}

{Pads or truncates a String and
Justifies Left if StrJustify=True}
Function StringPad(
    InputStr,
    FillChar: String;
    StrLen: Integer;
    StrJustify: Boolean): String;
Var
    TempFill: String;
    Counter : Integer;
Begin
    If Not (Length(InputStr) = StrLen) Then
    Begin
      If Length(InputStr) > StrLen Then
      Begin
        InputStr := Copy(InputStr,1,StrLen) ;
      End
      Else
      Begin
        TempFill := '';
        For Counter := 1 To StrLen-Length(InputStr) Do
        Begin
          TempFill := TempFill + FillChar;
        End;
        If StrJustify Then
        Begin
          {Left Justified}
          InputStr := InputStr + TempFill;
        End
        Else
        Begin
          {Right Justified}
          InputStr := TempFill + InputStr ;
        End;
      End;
    End;
    Result := InputStr;
End;


Function VersionInformation(
    ListBox : TListBox): Boolean;
const
    InfoNum = 11;
    InfoStr : array [1..InfoNum] of String =
      ('CompanyName', 'FileDescription', 'FileVersion',
'InternalName', 'LegalCopyright', 'LegalTradeMarks',
'OriginalFilename', 'ProductName', 'ProductVersion',
'Comments', 'Author') ;
    LabelStr : array [1..InfoNum] of String =
      ('Company Name', 'Description', 'File Version',
'Internal Name', 'Copyright', 'TradeMarks',
'Original File Name', 'Product Name',
'Product Version', 'Comments', 'Author') ;
var
    S : String;
    n, Len, j : Integer;
    Buf : PChar;
    Value : PChar;
begin
    Try
      S := Application.ExeName;
      ListBox.Items.Clear;
      ListBox.Sorted := True;
      ListBox.Font.Name := 'Courier New';
      n := GetFileVersionInfoSize(PChar(S),n) ;
      If n > 0 Then Begin
        Buf := AllocMem(n) ;
        ListBox.Items.Add
(StringPad('Size',' ',20,True)+' = '+IntToStr(n)) ;
        GetFileVersionInfo(PChar(S),0,n,Buf) ;
        For j:=1 To InfoNum Do Begin
          If VerQueryValue(Buf,PChar('StringFileInfo\040904E4\'+
                            InfoStr[j]),Pointer(Value),Len) Then
          Begin
            Value := PChar(Trim(Value)) ;
            If Length(Value) > 0 Then
            Begin
              ListBox.Items.Add
(StringPad(labelStr,' ',20,True)+' = '+Value) ;
            End;
          End;
        End;
        FreeMem(Buf,n) ;
      End
      Else Begin
        ListBox.Items.Add
('No FileVersionInfo found') ;
      End;
      Result := True;
    Except
      Result := False;
    End;
End;
~~~~~~~~~~~~~~~~~~~~~~~~~


Obrigado.
MuriloCunha





On 26/05/2010 14:43, Edelson Regis de Lima wrote:
> Boa tarde pessoal!
>
> Já dei uma pesquisada nas mensagens antigas do forum, mas não encontrei...
> Alguém sabe se dá para criar um arquivo, e no momento da sua criação
> informar o nome do Autor? (Aquela propriedade que o windows mostra quando
> vemos as propriedades do arquivo)
> E também como extrair de um arquivo o nome do Autor.
>
> A data e hora de criação eu já consegui extrair da seguinte maneira:
> FileDateToDateTime(FileAge('Nome_Do_Arquivo'))
>
> Mas preciso extrair também o nome do Autor.
>
> Obrigado!
>
> Edelson.
>
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
>
> ------------------------------------
>
>    

Responder a