VB
方法一:
MSDN: http://msdn.microsoft.com/zh-tw/library/system.environment.osversion.aspx
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Get the operating system version.
Dim os As OperatingSystem = Environment.OSVersion
Dim ver As Version = os.Version
Label1.Text = os.VersionString
Label2.Text = ver.ToString()
Label3.Text = My.Computer.Info.OSFullName & My.Computer.Info.OSVersion
End Sub
End Class
----
方法二:
MSDN: http://msdn.microsoft.com/zh-tw/library/vstudio/795sy883(v=vs.100).aspx
Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label4.Text = "Passing OSVersionInfo as a class"
Dim osvi As New OSVersionInfo()
osvi.OSVersionInfoSize = Marshal.SizeOf(osvi)
LibWrap.GetVersionEx(osvi)
Label5.Text = "Class size:" & osvi.OSVersionInfoSize
Label6.Text = "OS Version:" & osvi.MajorVersion & "." & osvi.MinorVersion
Label7.Text = "Passing OSVersionInfo2 as a struct"
Dim osvi2 As New OSVersionInfo2()
osvi2.OSVersionInfoSize = Marshal.SizeOf(osvi2)
LibWrap.GetVersionEx2(osvi2)
Label8.Text = "Struct size:" & osvi2.OSVersionInfoSize
Label9.Text = "OS Version:" & osvi2.MajorVersion & "." & osvi2.MinorVersion
End Sub
End Class
<StructLayout(LayoutKind.Sequential)> _
Public Class OSVersionInfo
Public OSVersionInfoSize As Integer
Public MajorVersion As Integer
Public MinorVersion As Integer
Public BuildNumber As Integer
Public PlatformId As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> _
Public CSDVersion As String
End Class
<StructLayout(LayoutKind.Sequential)> _
Public Structure OSVersionInfo2
Public OSVersionInfoSize As Integer
Public MajorVersion As Integer
Public MinorVersion As Integer
Public BuildNumber As Integer
Public PlatformId As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> _
Public CSDVersion As String
End Structure
Public Class LibWrap
Declare Ansi Function GetVersionEx Lib "kernel32" Alias _
"GetVersionExA" (<[In], Out> ByVal osvi As OSVersionInfo) As Boolean
Declare Ansi Function GetVersionEx2 Lib "kernel32" Alias _
"GetVersionExA" (ByRef osvi As OSVersionInfo2) As Boolean
End Class
2013年10月24日 星期四
訂閱:
文章 (Atom)
Python notes: Calculate delay time by WinDBG log
用WinDBG開Event Timestamps可以產生下面格式的log: Fri Sep 21 18:43:50.946 2018 (UTC + 8:00): @#$#^$@#$^ 以下python code用來找出兩個指定log中的時間差
-
今天照著mobile01的教學文把我的Incredible S預載的台灣大哥大無用軟體關閉了 在此做個筆記... 其實這支手機剛買來時就做過一樣的事了 但因年前HTC釋出了Android 2.3.5的更新, 使我已經ROOT的手機又再經過S-ON後復原 更新到Android 2....
-
這是上次去日本時遇到一個窘境時所找到的Windows7下的應用軟體 Connectify 儘管現在無線網路已經充斥在你我周遭, 但還是有些地方只有提供有線網路, 而沒有WIFI 像我去東京時下榻的飯店-- Sun Members Tokyo Shinjuku ...
-
最近買了房子, 身為勤儉持家的客家子弟怎麼可能去請室內設計師來呢 我要自己來! Google到這隻專門繪製室內格局圖的程式, 作者好像是個法國人, 有簡體中文的版本, 還是免費版的唷!