ComponentInstaller.CopyFromComponent(IComponent) Methode

Definition

Wenn eine abgeleitete Klasse überschrieben wird, werden alle Eigenschaften kopiert, die zur Installationszeit von der angegebenen Komponente benötigt werden.

public:
 abstract void CopyFromComponent(System::ComponentModel::IComponent ^ component);
public abstract void CopyFromComponent(System.ComponentModel.IComponent component);
abstract member CopyFromComponent : System.ComponentModel.IComponent -> unit
Public MustOverride Sub CopyFromComponent (component As IComponent)

Parameter

component
IComponent

Die Zu kopierende Komponente.

Beispiele

Im folgenden Beispiel wird eine Klasse MyInstallClassdefiniert, die das Ereignisprotokoll erstellt und die Eigenschaften der Ereignisprotokollkomponente in die EventLogInstallerEreignisprotokollkomponente kopiert. Außerdem wird überprüft, ob die ServiceInstaller Gleiche Art von Installation wie die .EventLogInstaller

EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller;
// Create a source for the specified event log, on local computer.
EventLog::CreateEventSource( "MyEventSource", "MyEventLog", "." );
// Create an event log instance and associate it with the log .
EventLog^ myEventLog = gcnew EventLog( "MyEventLog",".","MyEventSource" );
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller->CopyFromComponent( myEventLog );
EventLogInstaller myEventLogInstaller = new EventLogInstaller();
// Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource","MyEventLog", ".");
// Create an event log instance and associate it with the log .
EventLog myEventLog = new EventLog("MyEventLog", ".", "MyEventSource");
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog);
Dim myEventLogInstaller As New EventLogInstaller()
' Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource", "MyEventLog", ".")
' Create an event log instance and associate it with the log .
Dim myEventLog As New EventLog("MyEventLog", ".", "MyEventSource")
' Copy the properties that are required at install time from
' the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog)

Hinweise

Das Installationsprogramm sollte alle Informationen aus der Livekomponente abrufen und zur Installation speichern.

Gilt für: