189 8069 5689

vb.net获取版本号 vb net use

vb.net 应用程序怎么获取自己的版本号

Try

创新互联公司成立与2013年,先为环江等服务建站,环江等地企业,进行企业商务咨询服务。为环江企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

Me.Text = "版本V" Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()

Catch ex As Exception

Me.Text = "未知版本"

End Try

vb.net 显示版本

这个你把1.0.2.3这个字符串处理下就可以了。

这个属于字符串的处理

vb做的软件如何获得自己的版本号?

如果你用的是vb6,而且指的是你在编译程序的时候写的版本号,比如1.0.1可以用app的属性得到

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 use
文章位置:http://jkwzsj.com/article/dohpiop.html

其他资讯