怎样获取任一应用程序的绝对路径??(100分)

to cakk;<br>那个对话矿里的程序,是在注册表里<br>
 
Caption := Application.ExeName;
 
&nbsp; 用api函数 查delphi的winapi32help
 
可用ExpandFileName()返回含路径及文件名的完整字符串信息,再用<br>ExtractFilePath()返回路径信息。<br>例:myfilename:=expandfilename('UEDIT32.EXE');<br>&nbsp; &nbsp; myfilepath:=extractfilepath(myfilename);<br>
 
答cAkk<br>当我们、双击一个未知类型的文件扩展名时,windows会打开一个dialog<br>让我们选取打开该类型文件的程序,凡是在那个对话框里列出来的程序都<br>可以通过FindExecutable找到原始路径。(√)<br><br>至于那个对话框的列表是如何形成的,我还没搞明白,在注册表里也没有。(X)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^^<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;有 &nbsp;<br>在运行中运行看看(%1可换为你想要的文件名):C:/WINDOWS/rundll32.exe <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^^^^^^^^^^<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 你的Windows目录<br>shell32.dll,OpenAs_RunDLL %1<br><br>注册表中的位置:<br>HKEY_CLASSES_ROOT/Unknown/shell/openas/command<br>
 
来晚了,用EXTRACTFILEPATH就可以了。
 
var &nbsp;<br>Path: PChar;<br>begin<br>&nbsp; Path := AllocMem(260);<br>&nbsp; FindExecutable('UEdit32.exe', '', Path); &nbsp;<br>&nbsp; ......<br>&nbsp; FreeMem(Path);end
 
注册表?I Like It!<br><br>例如说:*.pas<br>在 Hkey_Classes_Root 下面<br>有一个“.pas”的“路径”,<br>&nbsp; &nbsp; 其下有“(默认)”项,值为“DelphiUnit”,<br>有一个“DelphiUnit”的“路径”,<br>&nbsp; &nbsp; 其下有“(默认)”项,值为“Delphi Source File”(资源管理器中的“类型”),<br>&nbsp; &nbsp; 其下有“DefaultIcon”的“路径”,<br>&nbsp; &nbsp; &nbsp; &nbsp; “(默认)”项值为“F:/Borland 5/Delphi5/Bin/Delphi32.exe,5”(资源管理器中的图标)<br>&nbsp; &nbsp; 其下有“Shell/Open”的“路径”,<br>&nbsp; &nbsp; &nbsp; &nbsp; “(默认)”项值为“&amp;Open”(资源管理器中的右键菜单)<br>&nbsp; &nbsp; &nbsp; &nbsp; “command”路径下的“(默认)”项值为“F:/Borland 5/Delphi5/Bin/Delphi32.exe /np”<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(资源管理器中的右键菜单执行的命令行)<br><br>Sorry! 我要赶公交车,Bye!
 
Hkey_Classes_Root/MIME/Database/Content Type 下面有更多的东西!
 
用Application.exename 即可。<br>
 
近期结束
 
快快结束
 
接受答案了.
 
顶部