CSGetVersion Function


Get the Consoul DLL version (string). Consoul versions have the following format: XX.YY.ZZ where XX is the major version number, YY is the minor and ZZ is the revision. The version numbers are separated by a dot ('.') and can be 1 or 2 digits. Although this numbering scheme leads to 16 bytes max, 25 bytes should be allocated, as there can be additional characters denoting a specific build of the library (like 'b' for a beta version). This function directly writes at the memory location pointed by lpStringBufer. It's the host responsibility to ensure that the buffer is large enough (see sample in Remarks below).


VB/A 32bits

Private Declare Function CSGetVersion Lib "consoul_010205_32.dll" ( _
  ByVal lpStringBuffer As Long _
) As Integer

VB/A 64bits

Private Declare PtrSafe Function CSGetVersion Lib "consoul_010205_64.dll" ( _
  ByVal lpStringBuffer As LongPtr _
) As Integer

Return Value

The return value is always 0 (zero).



A valid memory pointer to an allocated buffer of at least 25 bytes. Reminder: Consoul uses UNICODE strings, where each character takes two bytes, and this function add an additional string terminator character (ie two more bytes).


Here's a sample of how to get the Consoul version in VB/A.

This is actually the "ConsoulVersion" property of the CConsoul class, which is part of the Consoul VB/A SDK:

Public Property Get ConsoulVersion() As String
  Dim sBuffer As String
  Dim i       As Integer
  sBuffer = Space$(25)  'at least 25 chars as specs tell
  Call CSGetVersion(StrPtr(sBuffer))
  sBuffer = StrConv(sBuffer, vbUnicode)
  i = InStr(1, sBuffer, Chr$(0))
  If i > 0 Then
    sBuffer = left$(sBuffer, i - 1)
  End If
  ConsoulVersion = sBuffer
End Property
Last updated: May 13 2022.