I have a Win32 application that has a dialog which does certain things only if the process is a restarted process. An outline is as follows:
#define CMDLINE_RESTART_PROCESS "--Restart"
BOOL CheckForProcessRestart()
{
LPTSTR szCmdLine = ::GetCommandLine()
return ::StrStr(szCmdLine, CMDLINE_RESTART_PROCESS) != NULL;
}
BOOL CMyDialog::InitInstance()
{
if(CheckForProcessRestart())
{
// Do something (like initialize certain variables, controls, etc)
}
// Rest of application
}
After I detect that the process is a restarted one and initialize those controls and variables, my dialog will do its thing and close.
This dialog is accessed by a menu in the main window. On click of that menu button, when this dialog pops up, it will again detect that it is a restarted process because GetCommandLine()
will get the original command-line parameters.
My question is, is there any way I can reset the command-line parameters after I handle them?
Thanks!