怎样在程序中用语句实现打开系统文件(就像在操作系统下双击某一文件一样)???(200分)

  • 主题发起人 主题发起人 chll
  • 开始时间 开始时间
uses ShellAPI;<br>ShellExecute(Handle,'open',pchar('1.txt'),nil,nil,sw_show);
 
如果是执行文件用这个也可以<br>winexec(pchar('1.exe'),sw_show);<br>
 
不一定是可执行文件,就是一般文件
 
ShellExecute,可以打开Exe及带关联的文件,如果不能打开,看返回值<br>0 The operating system is out of memory or resources.<br>ERROR_FILE_NOT_FOUND The specified file was not found.<br>ERROR_PATH_NOT_FOUND The specified path was not found.<br>ERROR_BAD_FORMAT The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).<br>SE_ERR_ACCESSDENIED The operating system denied access to the specified file. <br>SE_ERR_ASSOCINCOMPLETE The filename association is incomplete or invalid.<br>SE_ERR_DDEBUSY The DDE transaction could not be completed because other DDE transactions were being processed.<br>SE_ERR_DDEFAIL The DDE transaction failed.<br>SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out.<br>SE_ERR_DLLNOTFOUND The specified dynamic-link library was not found. <br>SE_ERR_FNF The specified file was not found. <br>SE_ERR_NOASSOC There is no application associated with the given filename extension.<br>SE_ERR_OOM There was not enough memory to complete the operation.<br>SE_ERR_PNF The specified path was not found.<br>SE_ERR_SHARE A sharing violation occurred.
 
打开系统文件?什么意思?<br>如果答案就是楼上给的,200分,啧啧,楼主真是“大富翁”,不,应该叫“大大富翁”。呵呵
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部