Extracting a int32 from a string (VB6)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sammy

    Extracting a int32 from a string (VB6)

    Subject line says it all really.
    I have a 4 character long string, that contains a 32bit integer. Problem is
    i have no idea how i go about extracting it.

    Any help will be appreciated.


  • J French

    #2
    Re: Extracting a int32 from a string (VB6)

    On Fri, 14 Nov 2003 12:39:07 -0000, "Sammy" <no@isp.com> wrote:
    [color=blue]
    >Subject line says it all really.
    >I have a 4 character long string, that contains a 32bit integer. Problem is
    >i have no idea how i go about extracting it.
    >
    >Any help will be appreciated.[/color]

    It may be 4 characters long, but due to the perversity of MS, it is 8
    bytes


    Private Declare Sub MoveString _
    Lib "kernel32" _
    Alias "RtlMoveMem ory" _
    (Dest As Any, _
    ByVal Source As String, _
    ByVal Bytes As Long)


    Public Function CVL(S$) As Long
    If Len(S$) < 4 Then
    MsgBox "CVL Error - String too Short"
    Exit Function
    End If
    Call MoveString(CVL, S$, 4)
    End Function

    Comment

    • Sammy

      #3
      Re: Extracting a int32 from a string (VB6)

      Perfect, thanks very much for the help.

      Sammy.

      "J French" <erewhon@nowher e.com> wrote in message
      news:3fb4deed.1 93125424@news.b tclick.com...[color=blue]
      > On Fri, 14 Nov 2003 12:39:07 -0000, "Sammy" <no@isp.com> wrote:
      >[color=green]
      > >Subject line says it all really.
      > >I have a 4 character long string, that contains a 32bit integer. Problem[/color][/color]
      is[color=blue][color=green]
      > >i have no idea how i go about extracting it.
      > >
      > >Any help will be appreciated.[/color]
      >
      > It may be 4 characters long, but due to the perversity of MS, it is 8
      > bytes
      >
      >
      > Private Declare Sub MoveString _
      > Lib "kernel32" _
      > Alias "RtlMoveMem ory" _
      > (Dest As Any, _
      > ByVal Source As String, _
      > ByVal Bytes As Long)
      >
      >
      > Public Function CVL(S$) As Long
      > If Len(S$) < 4 Then
      > MsgBox "CVL Error - String too Short"
      > Exit Function
      > End If
      > Call MoveString(CVL, S$, 4)
      > End Function
      >[/color]


      Comment

      Working...