Help With My Interface

Silv3rSurf3r_19
02-02-2002, 11:53 AM
Greetings People,

I'm new to this forum and so am i to VB... i need help on a program that i'm currently working on. It is a chat program and i'm at the final stages of work. I need a few questions answered before i can get on with finishing my program.
Firstly,
Does anyone know how to create a File Transfer between 2 users. I have created one... but i doubt it's gonna work... it doesn't sound quite right... and also i need to know how to create an upload and download Form... where i can upload files to a server and some other user can download it... please advice.

Secondly,
How do i create a contact list quite like MSN... the collapsable list... do i use the tree view function? and also... can i put both my online and offline users on the same list without affecting it... actually i don't know how to do it... please help... thank you very much

Regards
~JoHn~

ChiefRedBull
02-02-2002, 12:21 PM
Doesn't sound like youre on the final stages of a chat program to me....

OK, first: a file transfer is the same as transferring strings. You will need to open the file for binary, read the data into a byte array, then send that. At the other end, hold it in another byte array, reassemble it, and bingo. I'm working on a file transfer class at the moment....
Second: The upload download form is most likely going to use the Internet Transfer Control (Inet). It has the icFTP protocol usage, and allows it to perform as an FTP server. Logging into a server is as simple as setting a few properties and connecting. Search the forum for "inet" and "ftp".
Third: MSNs contact list is most likely subclassed and owner drawn. Its very complicated, I woudl suggest using the treeview, or perhaps even a plain listbox to start with, until you get the functionality working.

Silv3rSurf3r_19
02-03-2002, 11:57 AM
Ok thanx for explaining it to me...

but i have to say i'm new to vb and well i see the logic to it... but how do i get it done... i'm gonna need help on openining the file for binary, read the data into a byte array that kinda stuff. and also hold it in another byte array and reassemble it.

basically all i have now is..

Dialog.Filter = "All Files | *.*"
Dialog.ShowOpen
File = Dialog.FileName

Open File For Binary As #1
FileLength = Len(File)
FileTransfer.ProgressBar1.Max = FileLength
FileTransfer.ProgressBar1.Value = 0
FileTransfer.Status.Caption = "Initialising..."
DoEvents
FileTransfer.Status.Caption = "Initiating File Transfer..."
Close #1

SendingFile = False
AbortFile = False

WinsockClient.SendData "f" & Chr(1) & File

Do Until SendingFile Or AbortFile Or DoEvents = 0
DoEvents
Loop
WinsockClient.SendData File

Lemme know where i've gone wrong... thanx

Banjo
02-05-2002, 06:36 AM
OK, you need to re-arrange your code somewhat. Have a look:
Dim bytesTransferred as Long

Dialog.Filter = "All Files | *.*"
Dialog.ShowOpen
File = Dialog.FileName

FileTransfer.ProgressBar1.Value = 0
FileTransfer.ProgressBar1.Max = 100
FileTransfer.Status.Caption = "Initiating File Transfer..."

Open File For Binary As #1
AbortFile = False
WinsockClient.SendData "f" & Chr(1) & File

Do Until AbortFile = True Or EOF(1) = True
Line Input #1, inLine
WinsockClient.SendData inLine & vbCrLf
bytesTransferred = bytesTransfered + Len(inLine) + 2
FileTransfer.ProgressBar1.Value = (bytesTransferred / LOF(1)) * 100
DoEvents
Loop
Close #1

Basically, what it does is:

Open the file
Loop until the End of File or abort is set
Get a line of text
Send it
Increment the number of bytes transferred.
Update the progress bar
Loop
Close the file.

The reason for doing the progress bar like that is so that it can handle files whose size is greater than 32,767 bytes. That is the maximum value that can be stored in the ProgressBar's max property. By reducing it to a percentage it can handle large files.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum