
|
Parameter |
Bedeutung |
|---|---|
|
/a, /a xxxx, -a |
Passwortdialog : Mit dem Parameter a wird der Passwortdialog gestartet. Mit dem 2. Parameter xxxx wird das Handle für die Passwortfunktion übergeben. Bei Windows NT & 2000 gibt es das Handle nicht. |
|
/c, /c, -c |
Konfigurationsdialog : Der Parameter c startet den Konfigurationsdialog. |
|
/p, /p xxxx, -p |
Vorschaufenster : Der Bildschirmschoner läuft im Vorschaufenster ab. Mit xxxx wird das Handle ( HWND ) für das Fenster übergeben. |
|
/s -s |
Bildschirmschoner im Vollbildmodus : Mit dem Parameter s wird der Bildschirmschoner im Vollbildmodus gestartet |
Beispiel : Abfrage der Kommandozeilenparameter :
//---------------------------------------------------------------------------
// Kommandolineabfrage mit dem Borland C++ Builder
// In das Vorschaufenster wird ein Bitmap geladen
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE , HINSTANCE, LPSTR, int)
{
if( __argc > 1 )
{
try
{
// Kommandoline testen( Parameter abfragen )
char c[255];
strcpy( c, __argv[1] );
// Welche Windowsversion läuft
OSVERSIONINFO info;
info.dwOSVersionInfoSize = sizeof( info );
GetVersionEx( &info );
for( unsigned int z = 0; z < strlen(c); z++ )
{
if(( c[z] == '-') || ( c[z] == '/') )
{
z++;
// Einstellungsfenster
if(( c[z] == 'c') || (c[z] == 'C') )
{
MessageBox( NULL, "Konfigurationsdialog",
"Einstellung", MB_OK );
return 0;
}
// Vorschau
if((c[z] == 'p') || (c[z] == 'P'))
{
if ( __argc <= 2 ) return 0;
HWND HPre;
sscanf(__argv[2], "%d", &HPre );
TCanvas *PreCanvas = new TCanvas;
TRect MyRect;
AnsiString szBitmap;
// Bmp aus Windowsverzeichnis lesen
szBitmap.SetLength( MAX_PATH );
szBitmap.SetLength( GetWindowsDirectory( szBitmap.c_str(),
szBitmap.Length() ) );
szBitmap += "\\setup.bmp";
Graphics::TBitmap* bitmap1 = new Graphics::TBitmap();
bitmap1->LoadFromFile( szBitmap );
do
{
Application->ProcessMessages();
}
while ( IsWindowVisible( HPre ) == 0 );
PreCanvas->Handle = GetDC( HPre );
if ( PreCanvas->Handle == NULL )
MessageBox( NULL, "Meldung",
"Handle", MB_OK );
GetClientRect( HPre, &MyRect );
do
{
PreCanvas->StretchDraw( MyRect, bitmap1 );
Application->ProcessMessages();
} while( IsWindowVisible(HPre) != 0 );
delete PreCanvas;
delete bitmap1;
return 0;
}
// Bildschirmschoner
if( (c[z] == 's') || (c[z] == 'S') )
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
// Passwortdialog
if(( c[z] == 'a') || (c[z] == 'A') )
{
// Nur unter Windows 95 & 98 starten
if( info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
{
HWND hPass;
typedef DWORD (FAR PASCAL *PWCHGPROC)( LPCTSTR, HWND, DWORD, LPVOID );
HINSTANCE hmpr;
sscanf(__argv[2], "%d", &hPass );
hmpr = LoadLibrary( "MPR.DLL" );
if( hmpr )
{
PWCHGPROC pwd = (PWCHGPROC)GetProcAddress( hmpr,
"PwdChangePasswordA" );
if( pwd ) pwd( "SCRSAVE", hPass, 0, NULL );
FreeLibrary( hmpr );
}
}
return 0;
}
}
}
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
return 0;
}
Informationsquellen :
PC Magazin 11/2000 Seite: 252
Microsoft Visual C++ 6.0 Dokumenation ( SCRNSAVE.CXX )
Letzte Änderung am : 04.11.2001, Autor : Manfred Ebert