我写的这段程序那里不对(20分)

  • 主题发起人 royal666
  • 开始时间
R

royal666

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFrmMain.FormActivate(Sender: TObject);<br>begin<br>&nbsp; ShowWindow(Handle, SW_HIDE);<br>&nbsp; If (ParamCount &lt;2)or (ParamCount &gt;3) &nbsp; then<br>&nbsp; &nbsp; Erreur('Use : CopyRep &lt;Repertoire Source&gt; &lt;Repertoire Destination&gt;')<br>&nbsp; else if ParamCount=2 then<br>&nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if not DirectoryExists(ParamStr(1)) then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Erreur('源目录不存在..');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if not DirectoryExists(ParamStr(2)) then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Erreur('目标目录不存在');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Label1.Caption := ParamStr(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Label2.Caption := ParamStr(2);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CopyDir(ParamStr(1),ParamStr(2));<br>&nbsp; &nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp; else if ParamCount=3 then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Case Paramstr(3)[0] of<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'O' &nbsp; &nbsp; : DelAndCopyDir(Paramstr(1),Paramstr(2));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'N' &nbsp; &nbsp; : exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ' ' &nbsp; &nbsp; : if MessageDlg('目标目录已存在,覆盖?',mtWarning,[mbYes,mbNo],0) = mrNo then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else DelAndCopyDir(Paramstr(1),Paramstr(2));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br><br>end;<br>为什么当我在windows2000的“运行”中打入 <br>d:/project/copydir/copyrep d:/wince d:/fonts N,总是出错,出现对话框 Usage : CopyRep &lt;Repertoire Source&gt; &lt;Repertoire Destination&gt;,难道她不识别 ParamCount=3吗?????<br>
 
这样试一试:<br>&nbsp;d:/project/copydir/copyrep "d:/wince" "d:/fonts" "N"<br>用双引号吧每个参数引起来。<br><br>还有,你的 case 语句应该是这样:Case Paramstr(3)[1] of<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; ~~~/<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;是 1,不是 0<br>
 
beta,为什么是1,而不是0呢?Paramstr(3)[0]不是字符串的第一个字符吗?Paramstr(3)[1]代表什么?<br>
 
谢谢你,真的成功了,为什么要用双引号吧每个参数引起来
 
beta,为什么我在引用ShowWindow(Handle, SW_HIDE);时会有“Cannot change visible in <br>onshow or onhide”我改在工程中引用Application.ShowMainForm :=False;会有相同的错误,<br>为什么?现象是有时引用无错误,有时引用有错误,为什么?<br>谢谢你!!!!
 
顶部