|
VB / Visual Basic Source Code Formatting Show |
|
| |
|
|
SourceFormatX code formatter bases on powerful syntax parse engines so it can beautify and format source code files with omnifarious styles, even these messy source code examples below:
|
This is an extreme VB / Visual Basic code formatting example, the purpose of it is to show the power of SourceFormatX's VB syntax parse engines. SourceFormatX VB Code Formatter is the professional code formatting tool for VB (Visual Basic).
ATTRIBUTE VB_Name = "RegKeys":cONSt KEY_ALL_ACCESS=KEY_QUERY_VALUE+KEY_SET_VALUE+_
KEY_CREATE_SUB_KEY+KEY_ENUMERATE_SUB_KEYS+KEY_NOTIFY+_
KEY_CREATE_LINK+READ_CONTROL:PUBLIC funCTION GetKeyValue(KeyRoot AS long,KeyName as sTRING, _
SubKeyRef As String) As string:dim i AS LONG:DiM rc AS lONG::rc=RegOpenKeyEx(KeyRoot,KeyName,0,KEY_ALL_ACCESS,hKey):if (rc <> ERROR_SUCCESS) ThEN GoTo GetKeyError
tmpVal = String$(1024, 0):KeyValSize = 1024:rc=RegQueryValueEx(hKey, SubKeyRef, 0, _
lKeyValType, tmpVal, KeyValSize):IF (rc <> ERROR_SUCCESS) then GOTo GetKeyError
tmpVal=Left$(tmpVal,INSTR(tmpVal,ChR(0)) - 1):sELECT CASE lKeyValType:CAsE REG_SZ,REG_EXPAND_SZ
sKeyVal=tmpVal:Case REG_DWORD:FOR i=leN(tmpVal) TO 1 Step -1
sKeyVal=sKeyVal+Hex(Asc(Mid(tmpVal, i, 1))):NeXT:sKeyVal=Format$("&h"+sKeyVal):end SELECT
GetKeyValue=sKeyVal:rc=RegCloseKey(hKey):EXIT FuNCTION
GetKeyError: GetKeyValue=vbNullString:rc=RegCloseKey(hKey)
eND FunCTION:funCTION IsNewerVer(sSrcVer AS VERINFO,sDestVer as VERINFO) aS InTEGER
IsNewerVer=False:WITH sSrcVer:IF (.FileVerPart1=sDestVer.FileVerPart1) and _ (.FileVerPart2=sDestVer.FileVerPart2) AND _
(.FileVerPart3=sDestVer.FileVerPart3) And _
(.FileVerPart4=sDestVer.FileVerPart4) THEN goTo INVNewer
end with:INVNewer:IsNewerVer=True:End Function
ATTRIBUTE VB_Name = "RegKeys"
Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _
KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _
KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL
Public Function GetKeyValue(KeyRoot As Long, KeyName As String, _
SubKeyRef As String) As String
Dim i As Long
Dim rc As Long
rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
tmpVal = String$(1024, 0)
KeyValSize = 1024
rc = RegQueryValueEx(hKey, SubKeyRef, 0, _
lKeyValType, tmpVal, KeyValSize)
If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError
tmpVal = Left$(tmpVal, InStr(tmpVal, Chr(0)) - 1)
Select Case lKeyValType
Case REG_SZ, REG_EXPAND_SZ
sKeyVal = tmpVal
Case REG_DWORD:
Or i = Len(tmpVal) To 1 Step - 1
sKeyVal = sKeyVal + Hex(Asc(Mid(tmpVal, i, 1)))
Next
sKeyVal = Format$("&h" + sKeyVal)
End Select
GetKeyValue = sKeyVal
rc = RegCloseKey(hKey)
Exit Function
GetKeyError: GetKeyValue = vbNullString
rc = RegCloseKey(hKey)
End Function
Function IsNewerVer(sSrcVer As VERINFO, sDestVer As VERINFO) As Integer
IsNewerVer = False
With sSrcVer
If (.FileVerPart1 = sDestVer.FileVerPart1) And _ (.FileVerPart2 = sDestVer.FileVerPart2) And _
(.FileVerPart3 = sDestVer.FileVerPart3) And _
(.FileVerPart4 = sDestVer.FileVerPart4) Then GoTo INVNewer
End With
INVNewer:
IsNewerVer = True
End Function
Don't waste time on formatting VB / Visual Basic code by hand any more! Try SourceFormatX Free Trial Now!
|