BCB 6 從命令列傳遞參數的方法

BCB6 的 code , 要從命令列加參數來當做程式執行的條件
Example 摘錄自 help 檔 ParamCount, ParamStr Example …

The following example beeps once for each \”beep\” passed in on the command line. The example terminates the application if \”exxit\” is passed in on the command line.


void __fastcall TForm1::FormCreate(TObject *Sender)

{
  for (int i=1;i<=ParamCount();i++)
  {
    if (LowerCase(ParamStr(i)) == \"beep\")
      Beep(10000,1000);
    elseif (LowerCase(ParamStr(i)) == \"exit\")
      Application->Terminate();
  }
}
Share your vote!


Do you like this post?
  • Fascinated
  • Happy
  • Sad
  • Angry
  • Bored
  • Afraid

Leave a Reply

Your email address will not be published. Required fields are marked *


Please help to input verification code