Results 1 to 4 of 4

Thread: exe growing as it runs

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    7

    exe growing as it runs

    I am using winsock to transfer a stream of jpg files and the exe grows by about 300 kb as it streams. When it's idle it does not have a memory leak. The stream is just a bininary chunk being collected and plopped in a picture box. I'm setting the buffer to empty before asking for another jpg.


    Private Sub WServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)

    Dim recBuffer As String

    On Error GoTo GErr

    WskServer(Index).GetData recBuffer

    DstPath = "C:\camcap.jpg"
    FL = FreeFile

    On Error Resume Next
    If Len(Dir(DstPath)) > 0 Then
    Kill DstPath
    End If

    Open "C:\camcap.jpg" For Binary As #2

    BytesRec = BytesRec + Len(recBuffer)
    Put #2, , recBuffer
    Close #2
    DoEvents
    form1.Image1 = LoadPicture("C:\camcap.jpg")
    DoEvents
    form1.Label5.Caption = BytesRec
    recBuffer = Empty
    WServer(Index).SendData "Msg_End"

    Exit Sub

    GErr:

    WServer(Index).SendData "Msg_Resnd"

    End Sub

    Any ideas??

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    7

    Re: exe growing as it runs

    Okay, it's only on the sending side not the recieving side, so scratch the code above as a problem.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    7

    Re: exe growing as it runs

    The problem is in here??


    Private Sub SendFile()

    Dim BufFile As String
    Dim LnFile As Long
    Dim nRemain As Long
    Dim mFile As String

    BufFile = Space(0)

    On Error Resume Next

    Kill ("c:\cam1.jpg")

    On Error GoTo GLerr:

    form1.VideoCap1.SnapShot ("c:\cam1.dib")
    DoEvents: DoEvents
    LoadBitmapFromFile "C:\cam1.dib" ' load bitmap
    DoEvents: DoEvents
    mFile = "c:\cam1.jpg"
    SaveJpegToFile mFile ' save the jpg
    DoEvents: DoEvents
    Kill ("c:\cam1.dib")
    DoEvents
    LnFile = FileLen(mFile)

    nRemain = LnFile

    If LnFile = 0 Or LnFile > 5000 Then
    MsgBox "Reset your Video Stream to a smaller size"
    Exit Sub
    End If

    If LnFile = 0 Then
    MsgBox "Zero Byte Stream- Check Camera Operation"
    Exit Sub
    End If

    Open mFile For Binary As #1
    BufFile = String(nRemain, " ")
    Get #1, , BufFile
    WClient.SendData BufFile

    'using this instead of video preview, allows true repre of sent video

    form1.Image2 = LoadPicture("C:\cam1.jpg")
    Close #1
    Exit Sub

    GLerr:

    Exit Sub

    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    7

    Re: exe growing as it runs

    Figured it out, it was the bitmap to jpg converter. Saved snapshot directly to a jpg and it stoped memory growth. The file went from 3 to 5 kb but it is better quality. I'll see how it holds up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width