C++ Builder Snippets  

Systemsteuerung-Applets ausführen:
 
//---------------------------------------------------------------------------
// Zugriffskonstanten für die Funktion RunControlPanelApplet()
//---------------------------------------------------------------------------
const int CP_CONTROL_PANEL   = 1;     // Gesamte Systemsteuerung
const int CP_ACCESS_KEYBOARD = 2;     // Eingabehilfen -> Tastatur
const int CP_ACCESS_SOUNDS   = 3;     // Eingabehilfen -> Akustische Signale
const int CP_ACCESS_DISPLAY  = 4;     // Eingabehilfen -> Anzeige
const int CP_ACCESS_MOUSE    = 5;     // Eingabehilfen -> Maus
const int CP_ACCESS_GENERAL  = 6;     // Eingabehilfen -> Allgemein
const int CP_SOFT_DEINSTALL  = 7;     // Software -> (De-)Installieren
const int CP_SOFT_WINSETUP   = 8;     // Software -> Windows-Setup
const int CP_SOFT_STARTDISK  = 9;     // Software -> Startdikette
const int CP_DISPLAY_BG      = 10;    // Anzeige -> Hintergrund
const int CP_DISPLAY_SSAVER  = 11;    // Anzeige -> Bildschirmschoner
const int CP_DISPLAY_COLORS  = 12;    // Anzeige -> Darstellung
const int CP_DISPLAY_SETTINGS = 13;   // Anzeige -> Einstellungen
const int CP_COUNTRY_SETTINGS = 14;   // Ländereinstellungen -> Ländereinstellungen
const int CP_COUNTRY_NUMBERS  = 15;   // Ländereinstellungen -> Zahlen
const int CP_COUNTRY_MONEY    = 16;   // Ländereinstellungen -> Währung
const int CP_COUNTRY_TIME     = 17;   // Ländereinstellungen -> Uhrzeit
const int CP_COUNTRY_DATE     = 18;   // Ländereinstellungen -> Datum
const int CP_GAME_CONTROLLER  = 19;   // Gamecontroller
const int CP_MOUSE            = 20;   // Maus
const int CP_KEYBOARD         = 21;   // Tastatur
const int CP_PRINTER          = 22;   // Drucker
const int CP_FONTS            = 23;   // Schriftarten
const int CP_MMEDIA_AUDIO     = 24;   // Multimedia -> Audio
const int CP_MMEDIA_VIDEO     = 25;   // Multimedia -> Video
const int CP_MMEDIA_MIDI      = 26;   // Multimedia -> Midi
const int CP_MMEDIA_AUDIO_CD  = 27;   // Multimedia -> Audio-CD
const int CP_MMEDIA_DEVICES   = 28;   // Multimedia -> Geräte
const int CP_MODEMS           = 29;   // Modems
const int CP_NETWORK          = 30;   // Netzwerk
const int CP_PASSWORDS        = 31;   // Kennwörter
const int CP_SYSTEM           = 32;   // System -> Allgemein
const int CP_SYSTEM_DEV_MANAGER = 33; // System -> Gerätemanager
const int CP_SYSTEM_HW_PROFILES = 34; // System -> Hardwareprofile
const int CP_SYSTEM_PERFORMANCE = 35; // System -> Leistungsmerkmale
const int CP_HARDWARE_ASSISTENT = 36; // Hardwareassistent
const int CP_DATE_TIME          = 37; // Datum, Uhrzeit

//---------------------------------------------------------------------------
// Funktion RunControlPanelApplet(int ilKind) führt ein Applet aus der 
// Windows-Systemsteuerung aus. Als Übergabeparameter erwartet die 
// Funktion eine der oben aufgelisteten Zugriffskonstanten
//---------------------------------------------------------------------------
void RunControlPanelApplet(int ilKind)
{
  AnsiString slCmdLine = EmptyStr;
  switch(ilKind)
  {
    case CP_CONTROL_PANEL:
      slCmdLine = "shell32.dll,Control_RunDLL";
      break;
    case CP_ACCESS_KEYBOARD:
      slCmdLine = "shell32.dll,Control_RunDLL access.cpl,,1";
      break;
    case CP_ACCESS_SOUNDS:
      slCmdLine = "shell32.dll,Control_RunDLL access.cpl,,2";
      break;
    case CP_ACCESS_DISPLAY:
      slCmdLine = "shell32.dll,Control_RunDLL access.cpl,,3";
      break;
    case CP_ACCESS_MOUSE:
      slCmdLine = "shell32.dll,Control_RunDLL access.cpl,,4";
      break;
    case CP_ACCESS_GENERAL:
      slCmdLine = "shell32.dll,Control_RunDLL access.cpl,,5";
      break;
    case CP_SOFT_DEINSTALL:
      slCmdLine = "shell32.dll,Control_RunDLL appwiz.cpl,,1";
      break;
    case CP_SOFT_WINSETUP:
      slCmdLine = "shell32.dll,Control_RunDLL appwiz.cpl,,2";
      break;
    case CP_SOFT_STARTDISK:
      slCmdLine = "shell32.dll,Control_RunDLL appwiz.cpl,,3";
      break;
    case CP_DISPLAY_BG:
      slCmdLine = "shell32.dll,Control_RunDLL desk.cpl,,0";
      break;
    case CP_DISPLAY_SSAVER:
      slCmdLine = "shell32.dll,Control_RunDLL desk.cpl,,1";
      break;
    case CP_DISPLAY_COLORS:
      slCmdLine = "shell32.dll,Control_RunDLL desk.cpl,,2";
      break;
    case CP_DISPLAY_SETTINGS:
      slCmdLine = "shell32.dll,Control_RunDLL desk.cpl,,3";
      break;
    case CP_COUNTRY_SETTINGS:
      slCmdLine = "shell32.dll,Control_RunDLL intl.cpl,,0";
      break;
    case CP_COUNTRY_NUMBERS:
      slCmdLine = "shell32.dll,Control_RunDLL intl.cpl,,1";
      break;
    case CP_COUNTRY_MONEY:
      slCmdLine = "shell32.dll,Control_RunDLL intl.cpl,,2";
      break;
    case CP_COUNTRY_TIME:
      slCmdLine = "shell32.dll,Control_RunDLL intl.cpl,,3";
      break;
    case CP_COUNTRY_DATE:
      slCmdLine = "shell32.dll,Control_RunDLL intl.cpl,,4";
      break;
    case CP_GAME_CONTROLLER:
      slCmdLine = "shell32.dll,Control_RunDLL joy.cpl";
      break;
    case CP_MOUSE:
      slCmdLine = "shell32.dll,Control_RunDLL main.cpl @0";
      break;
    case CP_KEYBOARD:
      slCmdLine = "shell32.dll,Control_RunDLL main.cpl @1";
      break;
    case CP_PRINTER:
      slCmdLine = "shell32.dll,Control_RunDLL main.cpl @2";
      break;
    case CP_FONTS:
      slCmdLine = "shell32.dll,Control_RunDLL main.cpl @3";
      break;
    case CP_MMEDIA_AUDIO:
      slCmdLine = "shell32.dll,Control_RunDLL mmsys.cpl,,0";
      break;
    case CP_MMEDIA_VIDEO:
      slCmdLine = "shell32.dll,Control_RunDLL mmsys.cpl,,1";
      break;
    case CP_MMEDIA_MIDI:
      slCmdLine = "shell32.dll,Control_RunDLL mmsys.cpl,,2";
      break;
    case CP_MMEDIA_AUDIO_CD:
      slCmdLine = "shell32.dll,Control_RunDLL mmsys.cpl,,3";
      break;
    case CP_MMEDIA_DEVICES:
      slCmdLine = "shell32.dll,Control_RunDLL mmsys.cpl,,4";
      break;
    case CP_MODEMS:
      slCmdLine = "shell32.dll,Control_RunDLL modem.cpl";
      break;
    case CP_NETWORK:
      slCmdLine = "shell32.dll,Control_RunDLL netcpl.cpl";
      break;
    case CP_PASSWORDS:
      slCmdLine = "shell32.dll,Control_RunDLL password.cpl";
      break;
    case CP_SYSTEM:
      slCmdLine = "shell32.dll,Control_RunDLL sysdm.cpl,,0";
      break;
    case CP_SYSTEM_DEV_MANAGER:
      slCmdLine = "shell32.dll,Control_RunDLL sysdm.cpl,,1";
      break;
    case CP_SYSTEM_HW_PROFILES:
      slCmdLine = "shell32.dll,Control_RunDLL sysdm.cpl,,2";
      break;
    case CP_SYSTEM_PERFORMANCE:
      slCmdLine = "shell32.dll,Control_RunDLL sysdm.cpl,,3";
      break;
    case CP_HARDWARE_ASSISTENT:
      slCmdLine = "shell32.dll,Control_RunDLL sysdm.cpl @1";
      break;
    case CP_DATE_TIME:
      slCmdLine = "shell32.dll,Control_RunDLL timedate.cpl";
      break;
  }
  if(slCmdLine != EmptyStr)
    ShellExecute(0, "open", "rundll32.exe", slCmdLine.c_str(), 0, SW_SHOWNORMAL);
}



© '99-2001 by S. Kreutzmann