vb.net读取版本号 VB的版本
vb做的软件如何获得自己的版本号?
如果你用的是vb6,而且指的是你在编译程序的时候写的版本号,比如1.0.1可以用app的属性得到
创新互联从2013年创立,先为乌兰察布等服务建站,乌兰察布等地企业,进行企业商务咨询服务。为乌兰察布企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
MsgBox App.Major "." App.Minor "." App.Revision
其中major是主版本,minor是次版本,revision是修正
在.net中会比较麻烦点,参考下面
Type FileInfo
wLength As Integer
wValueLength As Integer
szKey As String * 16
dwSignature As Long
dwStrucVersion As Long
dwFileVersionMS As Long
dwFileVersionLS As Long
End Type
' NOTE: The following Declare statements are case sensitive.
Declare Function GetFileVersionInfo Lib "Version" _
Alias "GetFileVersionInfoA" (ByVal FileName$, _
ByVal dwHandle, ByVal cbBuff, ByVal lpvData$)
Declare Function GetFileVersionInfoSize Lib "Version" Alias _
"GetFileVersionInfoSizeA" (ByVal FileName$, dwHandle)
Declare Sub hmemcpy Lib "Kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, hpvSource As Any, ByVal cbBytes)
Function LOWORD(x As Long) As Integer
LOWORD = x And HFFFF
' Low 16 bits contain Minor revision number.
End Function
Function HIWORD(x As Long) As Integer
HIWORD = x \ HFFFF
' High 16 bits contain Major revision number.
End Function
'----------------------------------------
'以下为执行模块,在 VBE 界面按 F5 执行
'----------------------------------------
Function displayVersion()
Dim x As FileInfo
Dim FileVer As String
Dim FileName As String
Dim dwHandle, BufSize, lpvData$, R
'*** Get Version Information If Available ****
FileVer = ""
'FileName = 路径
FileName = Environ("windir") "\system32\msjet40.dll"
BufSize = GetFileVersionInfoSize(FileName, dwHandle)
If BufSize = 0 Then
MsgBox "Invalid File Name or no Version information available"
Exit Function
End If
lpvData$ = Space$(BufSize)
R = GetFileVersionInfo(FileName, dwHandle, BufSize, lpvData$)
hmemcpy x, ByVal lpvData$, Len(x)
'**** Parse File Version Number ****
FileVer = Trim$(Str$(HIWORD(x.dwFileVersionMS))) + "."
FileVer = FileVer + Trim$(Str$(LOWORD(x.dwFileVersionMS))) + "."
FileVer = FileVer + Trim$(Str$(HIWORD(x.dwFileVersionLS))) + "."
FileVer = FileVer + Trim$(Str$(LOWORD(x.dwFileVersionLS)))
MsgBox FileVer, 64, "Version of " FileName
End Function
本文来自CSDN博客,转载请标明出处:
VB.NET 注册表读取
VB.NET主要是利用RegistryKey类封装的方法、属性等来进行与注册表相关的各种操作。
请参阅RegistryKey类
Imports Microsoft.Win32
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As String = Registry.CurrentUser.GetSubKeyNames("")
End Sub
End Class
需要 Microsoft.Win32命名空间。
vb.net 应用程序怎么获取自己的版本号
Try
Me.Text = "版本V" Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
Catch ex As Exception
Me.Text = "未知版本"
End Try
vb获取硬件信息的代码
tmpstr=""
set fso=createObject("scripting.filesystemObject")
Set dc = fso.Drives
for each d in dc
If d.isReady Then
tmpstr=tmpstr "磁盘" d.DriveLetter ":" vbcrlf _
"可用空间:" (d.AvailableSpace/1024/1024/1024) " GB" vbcrlf _
"空余空间:" (d.FreeSpace/1024/1024/1024) " GB" vbcrlf _
"总空间大小:" (d.TotalSize/1024/1024/1024) " GB" vbcrlf _
"文件系统:" d.FileSystem vbcrlf _
"驱动器类型:" d.DriveType vbcrlf _
"是否就绪:" d.IsReady vbcrlf _
"路径:" d.Path vbcrlf _
"根目录:" d.RootFolder vbcrlf _
"序列号:" d.SerialNumber vbcrlf _
"共享名:" d.ShareName vbcrlf _
"卷名:" d.VolumeName vbcrlf vbcrlf
End If
Next
msgbox tmpstr
vb.net 显示版本
这个你把1.0.2.3这个字符串处理下就可以了。
这个属于字符串的处理
网站名称:vb.net读取版本号 VB的版本
文章源于:http://pwwzsj.com/article/hpeooh.html