次の方法で共有


ComponentInstaller.CopyFromComponent メソッド

派生クラスによってオーバーライドされた場合、指定したコンポーネントから、インストール時に必要なすべてのプロパティをコピーします。

Public MustOverride Sub CopyFromComponent( _
   ByVal component As IComponent _)
[C#]
public abstract void CopyFromComponent(IComponentcomponent);
[C++]
public: virtual void CopyFromComponent(IComponent* component) = 0;
[JScript]
public abstract function CopyFromComponent(
   component : IComponent);

パラメータ

  • component
    コピー元のコンポーネント。

解説

インストーラは、インストール時に使用できるように、ライブ コンポーネントから入手できる全情報を取得して格納しておく必要があります。

使用例

[Visual Basic, C#, C++] イベント ログを作成し、イベント ログ コンポーネントのプロパティを EventLogInstaller にコピーする、クラス MyInstallClass を定義する例を次に示します。またこの例では、 ServiceInstallerEventLogInstaller と同じ種類のインストールを実行できるかどうかをチェックします。

 
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)

[C#] 
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);

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

ComponentInstaller クラス | ComponentInstaller メンバ | System.Configuration.Install 名前空間