logo

如何获得Windows的启动模式?

作者:孟宪会 阅读:3826 发表于:2003-07-17 12:24:48

可以调用SystemInformation来判断 Windows 启动的模式和用户信息。代码如下:

Dim Label1 As System.Windows.Forms.Label = New System.Windows.Forms.Label() Label1.Location = New System.Drawing.Point(32, 40) Label1.Size = New System.Drawing.Size(224, 56) Me.Controls.AddRange(New Control() {Label1}) Dim str As String = "" str = System.Windows.Forms.SystemInformation.UserDomainName str = str + "/" + System.Windows.Forms.SystemInformation.UserName + vbCrLf Select Case System.Windows.Forms.SystemInformation.BootMode Case BootMode.FailSafe Label1.Text = "基本模式启动[安全模式]" Case BootMode.FailSafeWithNetwork Label1.Text = "基本模式启动[安全模式](网络功能可用)" Case BootMode.Normal Label1.Text = "标准模式启动" End Select Label1.Text = str + Label1.Text