| DemoGL::Reference::Functions::DEMOGL_AppRun |
int DEMOGL_AppRun( const HINSTANCE hInstance, const SStartupDat *psdStartupDat, const char *pszWindowTitle, const bool bUseCrypting, const byte byKey1, const byte byKey2, const int iRunType );
| RunType | Description |
| RUNTYPE_NORMAL | The default. Your application will run like a normal win32 application. DemoGL will open a startup dialog so the user can select runtime specific options, and when the user selects to start the application, the execution will continue by opening a window and run the application script. The values specified in psdStartupDat are used to preset options in the startup dialog, but are overruled by the eventually stored values in the registry. When the user selected this, the options selected are stored in the registry when the application is actually started, when the user clicks the start button. DEMOGL_AppRun will exit when the script is terminating the application or the user terminates the application. DemoGL will recover from errors during the startup of the application if the user selected runtime specific options that are not valid (for example a resolution that is not supported by the video adapter) |
| RUNTYPE_NODIALOG | As RUNTYPE_NORMAL, but no startup dialog is shown and DemoGL will use the values specified in psdStartupDat as specific runtime options. The user is not able to select an option how to run the application. No options are stored nor read from the registry. DEMOGL_AppRun will exit when the script is terminating the application or the user terminates the application. Any error during the startup of the application will result in application termination. DemoGL can't recover from errors caused by options set in psdStartupDat/i>, which are not valid during runtime. |
| RUNTYPE_SAVER_CONFIG | DemoGL will open the startup dialog of RUNTYPE_NORMAL, but now the user is able to set runtime specific options for the application when it's ran as a screensaver. DEMOGL_AppRun will exit as soon as the user clicks Save or Cancel. When the user set runtime specific options using this RunType, these options are used to run the application as a screensaver at every run. |
| RUNTYPE_SAVER_NORMAL | As RUNTYPE_NODIALOG, but DemoGL will now read the settings set by the user when the application was ran in RUNTYPE_SAVER_CONFIG, plus the application is ran as a screensaver, thus called by windows. Windows will call your application as a normal screensaver when you select your application as the windows screensaver and press Preview on the Screensaver tab in display properties, or when the time-out occurs set with the screensaver properties in display properties. DEMOGL_AppRun exits when the user moves the mouse or presses a key or when the script terminates DemoGL. |
| RUNTYPE_SAVER_PREVIEW | As RUNTYPE_SAVER_NORMAL, but now the application runs inside the small area on the screensaver tab. Windows will block all keyboard messages to the application, but mouse messages are still sent. Runtime specific settings are used, but not for windowsize, as the application runs inside an area specified by windows. |
| RUNTYPE_SAVER_PASSWORD | Not implemented. DemoGL will exit immediately. All successors of windows95 will do their own password unlocking when it comes to screensavers, as also WinNT/Windows2000, only windows95 does not but relies on the unlocking code inside the screensaver, controlled with this RunType, but it's not implemented inside DemoGL. |
| RUNTYPE_UNKNOWN | Used when the RunType could not be determined, it will result in a clean exit of DEMOGL_AppRun. |
The values specified in psdStartupDat are always overruled by the values eventually stored in the registry, except when you specify RUNTYPE_NODIALOG as RunType. psdStartupDat values are used as hints to set options in the startup dialog or the config dialog and as execution specific values when a startup dialog or config dialog is not applicable. The values set in the startup dialog and the config dialog are stored in different places in the registry. For RUNTYPE_NORMAL applications, the values are stored in the registry key HKCU/Software/DemoGL/Application/Application title/AppData. For RUNTYPE_SAVER_* applications, the values are stored in the registry key HKCU/Software/DemoGL/Screensaver/Application title/AppData, by using the RUNTYPE_SAVER_CONFIG RunType. It's recommended you should store custom application parameters inside these registry keys, depending on the RunType.
When you call DEMOGL_AppRun DemoGL will take over control of your application. The only code in your application that is called is the code inside the registered effectobjects. You should call DEMOGL_AppEnd after DEMOGL_AppRun returns, no matter what returnvalue it will return.
// 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();
Last changed on 16-feb-2001
©1999-2001 Solutions Design