Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INet control downloading WAV file

Status
Not open for further replies.

ClarkJeff

Programmer
Feb 28, 2002
46
US
I'm trying to download a WAV file programmatically via the INet control. Everything seems to work ok, but the final file is 20K larger than by using Right Mouse Save As... and the file isn't recognized by Windows Media Player. Is there any additional information that I need to strip off of the incoming data, such as header info? I'm using the GetChunk method in a loop. Thanks for any suggestions.

Jeff Clark
 
Thanks for the reply iNSTA. I already have VS6 SP5 installed. Any other suggestions? Thanks.
 
Jeff, have you tried to download the file normally using a Winsock control? Make sure it can be done on a different carrier than just the Inet control. I'll help you out with this, as I am unaware of your knowledge of HTTP:

Code:
Dim wavDocument As String

Sub Command1_Click

With Winsock1
    .RemoteHost = "the.remote.host"
    .RemotePort = 80
    .Connect

    Do
         DoEvents
    Loop Until .State = sckConnected

    .SendData "GET /mysound.wav" & vbCrLf 
    .SendData "Connection: close" & vbCrLf & vbCrLf
    DoEvents

    Do
         DoEvents
    Loop Until .State = sckClosed
End With

End Sub

Private Sub Winsock1_DataArrival(parameters slip by me at the moment)

Dim inData As String

Winsock1.GetData inData
wavDocument = wavDocument & inData

End Sub

Private Sub Winsock1_Close()

wavDocument = Mid(wavDocument, Instr(1, wavDocument, vbCrLf & vbCrLf) + 2)

Winsock1.Close
DoEvents

End Sub

This sample assumes you have a command button on a form, and a Winsock control; Winsock1. Try this sample, and if it still doesn't work, let us (me) know. -iNSTA
aim: instar4per
email: instar4per @ hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top