如何显示文件的属性?(50分)

  • 主题发起人 主题发起人 penga
  • 开始时间 开始时间
P

penga

Unregistered / Unconfirmed
GUEST, unregistred user!
如何显示文件的属性?
 
FileGetAttr
 
呵呵, 小天好快:-)<br>应该用GetFileAttributes, 看看win32的help.
 
如果想显示windows标准的"文件属性"窗口:<br>var SEI:SHELLEXECUTEINFO;<br>&nbsp; &nbsp; r:Longint; <br>begin<br>&nbsp; &nbsp;With SEI do<br>&nbsp; &nbsp; &nbsp;cbSize:= sizeof(SEI);<br>&nbsp; &nbsp; &nbsp;fMask:= SEE_MASK_NOCLOSEPROCESS Or _<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SEE_MASK_INVOKEIDLIST Or _<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SEE_MASK_FLAG_NO_UI;<br>&nbsp; &nbsp; &nbsp;hwnd:=handle;<br>&nbsp; &nbsp; &nbsp;lpVerb:= "properties";<br>&nbsp; &nbsp; &nbsp;lpFile:= "yourfilename";<br>&nbsp; &nbsp; &nbsp;lpParameters:=nil;<br>&nbsp; &nbsp; &nbsp;lpDirectory:=nil;<br>&nbsp; &nbsp; &nbsp;nShow:=0;<br>&nbsp; &nbsp; &nbsp;hInstApp:=0;<br>&nbsp; &nbsp; &nbsp;lpIDList:=0;<br>&nbsp;End;<br>&nbsp;r:= ShellExecuteEX(SEI);
 
FileGetAttr是Delphi自己的函数<br>
 
上面我的代码有误! 我再试试... :-(
 
var SEI:PSHELLEXECUTEINFOA;<br>begin<br>&nbsp; &nbsp;getmem(sei,sizeof(sei));<br>&nbsp; &nbsp;With SEI^ do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;cbSize:= sizeof(SEI&lt;font color=red&gt;&lt;b&gt;^&lt;/b&gt;&lt;/font&gt;);<br>&nbsp; &nbsp; &nbsp;fMask:= SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_INVOKEIDLIST Or SEE_MASK_FLAG_NO_UI;<br>&nbsp; &nbsp; &nbsp;wnd:=handle;<br>&nbsp; &nbsp; &nbsp;lpVerb:= 'properties';<br>&nbsp; &nbsp; &nbsp;lpFile:= 'd:/download/doc.zip'; &nbsp;//你自己的文件名<br>&nbsp; &nbsp; &nbsp;lpParameters:=nil;<br>&nbsp; &nbsp; &nbsp;lpDirectory:=nil;<br>&nbsp; &nbsp; &nbsp;nShow:=0;<br>&nbsp; &nbsp; &nbsp;hInstApp:=hInstance;<br>&nbsp; &nbsp; &nbsp;lpIDList:=nil;<br>&nbsp;End;<br>&nbsp;ShellExecuteEX(SEI);<br>&nbsp;freemem(sei);<br>
 
第二次的代码正确!<br><br>BTW: 嘿嘿,不好意思,错在cbSize:= sizeof(SEI^);这里了
 
to cAkk:<br>可以告诉我lpVerb除了'properties'和'open'还有别的吗?<br>
 
print,explorer<br>不过我没用过.
 
接受答案了.
 
后退
顶部