Windows フォーム アプリケーションにサポートを追加して、パラメーターを使用して起動できるようにするにはどうすればよいですか?
私はC++を使用しています。
args
Main メソッドに配列を追加するか、使用することができますEnvironment::GetCommandLineArgs()
だからどちらか
int Main(array<String^>^ args)
また
array<String^>^ args = Environment::GetCommandLineArgs();
次に、args 配列をループして、配列の内容に基づいて何をすべきかを決定します。
If you are writing Win32 gui application then your entry point it WinMain:
int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
);
The third parameter, lpCmdLine
is the command line passed to the application. The command line parameters passed to the application will be in that string.
main(int argc, char** argv)
実行可能プログラムには関数があります。渡されたコマンド ライン パラメータを解析し、argv
これらをメイン フォームに渡すだけです。