DemoGL::Reference::Functions::DEMOGL_ParseScreenSaverCL

DEMOGL_ParseScreenSaverCL

DEMOGL_ParseScreenSaverCL parses the command line parameters specified when the application started. This command line is passed to the WinMain function of the application as lpCmdLine. You pass this variable to DEMOGL_ParseScreenSaverCL. The command line parsing is needed for screensaver applications only. Windows systems specify on the command line how a screensaver application was started: in preview mode, in configuration mode, in normal mode or in password mode.

SScreenSaverCLParams
* DEMOGL_ParseScreenSaverCL(
	const LPSTR lpCmdLine
);
	
Parameters.
lpCmdLine
LPSTR pointer to the command line of the application. This parameter is received by the WinMain function of your application as lpCmdLine and you should pass that lpCmdLine to DEMOGL_ParseScreenSaverCL.

Return values.
Pointer to a SScreenSaverCLParams structure that contains the interpretation results of the command line parameters.

Remarks.
To effectively use DemoGL for screensaver applications, DemoGL has to know how Windows wants it to run. When you start the DemoGL part of your application by calling DEMOGL_AppRun, you have to specify a RunType, and in the screensaver case, a RUNTYPE_SAVER_* variant. You can determine which screen saver RunType variant you should pass to DemoGL by parsing the command line passed to the WinMain function. DemoGL will do this for you when you call DEMOGL_ParseScreenSaverCL. It will return a pointer to a SScreenSaverCLParams structure which contains the iSaverExecType parameter. You can easily determine which screen saver RunType variant you should pass to DEMOGL_AppRun by using the following table:

iSaverExecType RunType variant to use
DGL_SSAVERET_UNKNOWN RUNTYPE_UNKNOWN.
DGL_SSAVERET_CONFIG RUNTYPE_SAVER_CONFIG
DGL_SSAVERET_NORMAL RUNTYPE_SAVER_NORMAL
DGL_SSAVERET_PREVIEW RUNTYPE_SAVER_PREVIEW
DGL_SSAVERET_PASSWORD RUNTYPE_SAVER_PASSWORD

Please note that this is only needed for screensavers. Normal applications don't need to parse the command line. DEMOGL_ParseScreenSaverCL won't report useful information if you do in normal applications.

Example.
// Declare a pointer to the screensaver command line parameter structure
SScreenSaverCLParams	*pSSCLParams;
	
// Parse commandline for screensaver exectype
pSSCLParams=DEMOGL_ParseScreenSaverCL(lpCmdLine);

iRunType=RUNTYPE_NORMAL;

// start as a screensaver
switch(pSSCLParams->iSaverExecType)
{
	case DGL_SSAVERET_CONFIG:
	{
		/////////////////////////
		// Insert your own configwindow initialisation and start up code HERE
		// If you do you shouldn't enter DEMOGL_AppRun() below but include it
		// in your dialog with a button.
		/////////////////////////
		iRunType=RUNTYPE_SAVER_CONFIG;
	}; break;
	case DGL_SSAVERET_NORMAL:
	{
		iRunType=RUNTYPE_SAVER_NORMAL;
	}; break;
	case DGL_SSAVERET_PREVIEW:
	{
		iRunType=RUNTYPE_SAVER_PREVIEW;
	}; break;
	default:
	{
		// should not run, unknown or unsupported screensaver type.
		iRunType=RUNTYPE_UNKNOWN;	// will return immediately
	}; break;
}
// Start the application. We won't return until the demo ends (by userinteraction or by script) or 
// when a fatal error occurs.
DEMOGL_AppRun(hInstance, &sdStartupDatValues, "My title", false,0,0,iRunType);

// End it. Call this routine to signal DemoGL it's all over and it should release
// claimed resources.
DEMOGL_AppEnd();

Requirements.
DemoGL v1.3 (build 0112 or higher)

See also.
DEMOGL_AppRun, SScreenSaverCLParams

Last changed on 20-jan-2001

©1999-2001 Solutions Design