動作確認
C++ Builder XE4
Rad Studio 10.2 Tokyo Update 2 (追記: 2017/12/27)
アプリのキャプションに複数文字列のsuffixを追加したい。
例として"Test 1 B C"という文字列を追加したい。
実行時引数を使う。
Unit1.cpp
//---------------------------------------------------------------------------
# include <vcl.h>
# pragma hdrstop
# include "Unit1.h"
//---------------------------------------------------------------------------
# pragma package(smart_init)
# pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
	String mark = L"/caption=";
	for (int i=1; i<=ParamCount(); i++) {
		if (LowerCase(ParamStr(i)).Pos(mark) > 0) {
			String suffix = ParamStr(i).Delete(1,mark.Length());  // e.g. "/caption=Test_1_B_C"
			// 複数個の文字列を受けるためにいったん"_"付きで受けたものを"_"を消して使う
			suffix = StringReplace(suffix, L"_", L" ", TReplaceFlags()<<rfReplaceAll);
			String caption = L"Mysoftware";
			caption = caption + L" / " + suffix;
			this->Caption = caption;
		}
	}
}
//---------------------------------------------------------------------------
