如何调用系统的文件属性对话框?(30分)

S

sy0116

Unregistered / Unconfirmed
GUEST, unregistred user!
我知道一种用ShellexecuteEx调用文件属性对话框的方法,代码如下:<br>&nbsp; function &nbsp; ShowFileProperties(FileName: &nbsp; String; &nbsp; Wnd: &nbsp; HWND):Boolean;<br>&nbsp; var<br>&nbsp; &nbsp; &nbsp; sfi: &nbsp; TSHELLEXECUTEINFO;<br>&nbsp; begin<br>&nbsp; &nbsp; &nbsp; with &nbsp; sfi &nbsp; do<br>&nbsp; &nbsp; &nbsp; begin &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cbSize &nbsp; := &nbsp; SizeOf(sfi);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpFile &nbsp; := &nbsp; PAnsiChar(FileName); &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Wnd &nbsp; := &nbsp; Wnd; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fMask &nbsp; := &nbsp; SEE_MASK_NOCLOSEPROCESS &nbsp; or &nbsp; SEE_MASK_INVOKEIDLIST &nbsp; or &nbsp; SEE_MASK_FLAG_NO_UI;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpVerb &nbsp; := &nbsp; PAnsiChar('properties'); &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpIDList &nbsp; := &nbsp; nil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpDirectory &nbsp; := &nbsp; nil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nShow &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hInstApp &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpParameters &nbsp; := &nbsp; nil;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwHotKey &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hIcon &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hkeyClass &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hProcess &nbsp; := &nbsp; 0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpClass &nbsp; := &nbsp; nil;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; Result &nbsp; := &nbsp; ShellExecuteEX(@sfi);<br>&nbsp; end;<br><br>&nbsp; procedure &nbsp; TForm1.Button1Click(Sender: &nbsp; TObject);<br>&nbsp; begin<br>&nbsp; &nbsp; &nbsp; ShowFileProperties('c:/1.txt',Handle);<br>&nbsp; end;<br>但是我在我的机器上实验时发现,这样做确实可以调出文件属性对话框,但是当我退出test.exe时却会跳出一个错误说"0x5dd55dfe"指令引用的"0x00000020"内存不能为"read",<br>我用VC又写了了一个一样的程序,也有这个问题,请问要怎样才能正确的调用系统文件属性对话框呢?
 
测试过,代码没问题。
 
测试过,确实没有发生错误。<br>楼主还是看看其它地方吧。
 
可能是我的系统有问题,我测试了其他的软件,只要那个软件调出了文件属性对话框在退出的时候就会跳出这个错误,好奇怪啊
 
我也测试过没有问题
 
多人接受答案了。
 

Similar threads

I
回复
0
查看
442
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
1K
import
I
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部