IPGlobalProperties.HostName プロパティ

定義

ローカル コンピューターのホスト名を取得します。

public:
 abstract property System::String ^ HostName { System::String ^ get(); };
public abstract string HostName { get; }
member this.HostName : string
Public MustOverride ReadOnly Property HostName As String

プロパティ値

コンピューターの NetBIOS 名を格納している String インスタンス。

例外

Win32 関数呼び出しが失敗しました。

次のコード例では、ローカル コンピューターのネットワーク情報を表示します。

IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
Console::WriteLine( "Computer name: {0}", properties->HostName );
Console::WriteLine( "Domain name:   {0}", properties->DomainName );
Console::WriteLine( "Node type:     {0:f}", properties->NodeType );
Console::WriteLine( "DHCP scope:    {0}", properties->DhcpScopeName );
Console::WriteLine( "WINS proxy?    {0}", properties->IsWinsProxy );
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
Console.WriteLine("Computer name: {0}", properties.HostName);
Console.WriteLine("Domain name:   {0}", properties.DomainName);
Console.WriteLine("Node type:     {0:f}", properties.NodeType);
Console.WriteLine("DHCP scope:    {0}", properties.DhcpScopeName);
Console.WriteLine("WINS proxy?    {0}", properties.IsWinsProxy);

注釈

このプロパティは、NetBIOS ホスト名文字列を含むFIXED_INFO構造体を返すネイティブ IP ヘルパー関数 GetNetworkParams を呼び出します。 ホスト名の文字列は、15 文字を超えると切り捨てられます。

コンピューターの NetBIOS 名は、ネットワーク内で一意である必要があり、ドメイン名で完全修飾されていません。

適用対象