http://hubdog.csdn.net/UpdateList/ul20020411.htm Delphi深度探索-用外壳接口对系统进行管理1.安装Shell Controls and Automation 对象 在Delphi中选Project Import Type Library命令,在对话框中选Import Microsoft Shell Controls And Automation类型库(见下图2.18),点Install后,在Delphi的ActiveX控件板上就多了TShellFolderItem,TShellLinkObject,TShellFolderView,TShell,TSearchCommand等几个组件。
网上找到的,分享一下. 顺便楼上, 我直接去msdn 多好,何来这里问个,多此一举。 uses ComObj;function GetFileInfo(FileName:string):TStringList; var Shell, Folder, Info: variant; SL: TStringList; i: integer; begin SL:=TStringList.Create; Shell:=CreateOLEObject('Shell.Application'); Folder:=Shell.NameSpace(ExtractFilePath(FileName)); Info:= Folder.ParseName(ExtractFileName(FileName)); for i:=0 to 34 do if String(Folder.GetDetailsOf(Info,i))<>'' then SL.Add(Format('%-10s %-s',[string(Folder.GetDetailsOf('',i)), string(Folder.GetDetailsOf(Info,i))]));; Result:=SL; end;
来自:cAkk (Delphibbs的牛人) function GetVersion(filename:string):string; var InfoSize, Wnd: DWORD; VerBuf: Pointer; szName: array[0..255] of Char; Value: Pointer; Len: UINT; TransString:string; begin InfoSize := GetFileVersionInfoSize(PChar(FileName), Wnd); if InfoSize <> 0 then begin GetMem(VerBuf, InfoSize); try if GetFileVersionInfo(PChar(FileName), Wnd, InfoSize, VerBuf) then begin Value :=nil; VerQueryValue(VerBuf, '\VarFileInfo\Translation', Value, Len); if Value <> nil then TransString := IntToHex(MakeLong(HiWord(Longint(Value^)), LoWord(Longint(Value^))), 8); Result := ''; StrPCopy(szName, '\StringFileInfo\'+Transstring+'\FileVersion'); ^^^^^^^此处换成ProductVersion得到的是"产品版本" if VerQueryValue(VerBuf, szName, Value, Len) then Result := StrPas(PChar(Value)); end; finally FreeMem(VerBuf); end; end; end;
Delphi深度探索-用外壳接口对系统进行管理1.安装Shell Controls and Automation 对象 在Delphi中选Project Import Type Library命令,在对话框中选Import Microsoft Shell Controls And Automation类型库(见下图2.18),点Install后,在Delphi的ActiveX控件板上就多了TShellFolderItem,TShellLinkObject,TShellFolderView,TShell,TSearchCommand等几个组件。
从编程员的角度理解 NTFS 2000:流和硬链接这篇文章里提到,文件摘要信息也是一个NTFS流,
可以用BackupRead枚举出一个文件的所有流名称
用“文件名:流名称”的方式,使用CreateFile、ReadFile、WriteFile打开并读写不过我没有试出来 :(
SetFileVersionInfo
msdn上一堆,你看msdn吧,学delphi的兄弟们啊,sdk确实弱了那么一点点:(
uses ComObj;function GetFileInfo(FileName:string):TStringList;
var Shell, Folder, Info: variant;
SL: TStringList;
i: integer;
begin
SL:=TStringList.Create;
Shell:=CreateOLEObject('Shell.Application');
Folder:=Shell.NameSpace(ExtractFilePath(FileName));
Info:= Folder.ParseName(ExtractFileName(FileName));
for i:=0 to 34 do
if String(Folder.GetDetailsOf(Info,i))<>'' then
SL.Add(Format('%-10s %-s',[string(Folder.GetDetailsOf('',i)),
string(Folder.GetDetailsOf(Info,i))]));;
Result:=SL;
end;
function GetVersion(filename:string):string;
var
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
szName: array[0..255] of Char;
Value: Pointer;
Len: UINT;
TransString:string;
begin
InfoSize := GetFileVersionInfoSize(PChar(FileName), Wnd);
if InfoSize <> 0 then
begin
GetMem(VerBuf, InfoSize);
try
if GetFileVersionInfo(PChar(FileName), Wnd, InfoSize, VerBuf) then
begin
Value :=nil;
VerQueryValue(VerBuf, '\VarFileInfo\Translation', Value, Len);
if Value <> nil then
TransString := IntToHex(MakeLong(HiWord(Longint(Value^)), LoWord(Longint(Value^))), 8);
Result := '';
StrPCopy(szName, '\StringFileInfo\'+Transstring+'\FileVersion');
^^^^^^^此处换成ProductVersion得到的是"产品版本"
if VerQueryValue(VerBuf, szName, Value, Len) then
Result := StrPas(PChar(Value));
end;
finally
FreeMem(VerBuf);
end;
end;
end;