ComponentInstaller.CopyFromComponent(IComponent) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
När den åsidosätts i en härledd klass kopieras alla egenskaper som krävs vid installationstillfället från den angivna komponenten.
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)
Parametrar
- component
- IComponent
Komponenten som ska kopieras från.
Exempel
I följande exempel definieras en klass MyInstallClass, som skapar händelseloggen och kopierar egenskaperna för händelseloggkomponenten till EventLogInstaller. Den kontrollerar också om ServiceInstaller kan utföra samma typ av installation som 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)
Kommentarer
Installationsprogrammet bör ta all information den kan från livekomponenten och lagra den för användning vid installation.