关于文件关联(BCB)(50分)

  • 主题发起人 主题发起人 Action
  • 开始时间 开始时间
A

Action

Unregistered / Unconfirmed
GUEST, unregistred user!
在bcb中我用我的程序和*.dm文件相关联<br>当用户双击*.dm文件时<br>我如何得到传过来的文件名是什么?<br>
 
如果你的关联已经正确建立, 那使用paramstr即可<br>paramstr(0)为打开该文件的程序名,paramstr(1)为该文件名<br>
 
比如这样: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myregistry.OpenKey('/txtfile/shell/open/command',true);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myregistry.WriteString('','NotePad.exe %1');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myregistry.Free;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ParamCount&gt;=2 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp:=ParamStr(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For iCount:= 2 to ParamCount do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp:=temp+' '+paramstr(icount);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else temp:=Paramstr(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; winexec(pchar(temp),sw_normal);
 
greet with fu_xiang_yu
 
后退
顶部