ファイルが変更されているかどうか、および同じバージョン番号の出荷時の元のファイルと異なっているかどうかを指定する値を取得します。
Public ReadOnly Property IsPatched As Boolean
[C#]
public bool IsPatched {get;}
[C++]
public: __property bool get_IsPatched();
[JScript]
public function get IsPatched() : Boolean;
プロパティ値
ファイルがパッチされている場合は true 。それ以外の場合は false 。
使用例
GetVersionInfo を呼び出して、メモ帳の FileVersionInfo を取得する例を次に示します。次に、ブール値 IsPatched の状態をテキスト ボックスに出力します。このコードは、 textBox1
がインスタンス化されていることを前提にしています。
Private Sub GetIsPatched()
' Get the file version for the notepad.
Dim myFileVersionInfo As FileVersionInfo = _
FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
' Print whether the file has a patch installed.
textBox1.Text = "File has patch installed: " & myFileVersionInfo.IsPatched
End Sub 'GetIsPatched
[C#]
private void GetIsPatched() {
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
// Print whether the file has a patch installed.
textBox1.Text = "File has patch installed: " + myFileVersionInfo.IsPatched;
}
[C++]
private:
void GetIsPatched() {
// Get the file version for the notepad.
FileVersionInfo* myFileVersionInfo = FileVersionInfo::GetVersionInfo(S"%systemroot%\\Notepad.exe");
// Print whether the file has a patch installed.
textBox1->Text = String::Format( S"File has patch installed: {0}", __box(myFileVersionInfo->IsPatched));
}
[JScript]
private function GetIsPatched() {
//Get the file version for the notepad.
var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
//Print whether the file has a patch installed.
textBox1.Text = "File has patch installed: " + myFileVersionInfo.IsPatched;
}
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
FileVersionInfo クラス | FileVersionInfo メンバ | System.Diagnostics 名前空間