Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Severance on August 15, 2007, 07:49 PM

Title: IRC Client help
Post by: Severance on August 15, 2007, 07:49 PM
Well, ive decided that I would like to have visual basic as a language that I could fairly understand. So ive decided to try to program my own IRC client to get the hang of using the winsock control. So far, I have got the program able to connect to a given server on a given port with a given nickname, and it is able to join channels and send messages throughout the channel. The only thing that I cant figure out how to do now is tell the textbox to display incomming chat messages,  and display the userlist in another text box. I have come up with the code :
winsock.SendData "PRIVMSG" & " " & txtChannel & vbCrLf for the sending of the messages. But would receiving the messages use the same PRIVMSG command, only using GetData instead of SendData work? I hope I worded this right, but any help would be appreciated a lot.
Title: Re: IRC Client help
Post by: l2k-Shadow on August 15, 2007, 07:52 PM


Private Sub Winsock_DataArrival(ByVal bytesTotal as Long)
Dim Data As String
Winsock.GetData Data, vbString, bytesTotal
' Data should hold your incoming message.
End Sub
Title: Re: IRC Client help
Post by: Severance on August 15, 2007, 08:24 PM
Wow, didnt realize that would display messages too, thanks. But I have one more problem. I want to have two forms for this client. The first form is where the winsock is, and it has all the connection info and stuff. The seccond form is where the chatting goes down, with the userlist and such. My problem is, I do not know how to just display incomming messages in the seccond form. One again I would appreciate if anybody could assist me in this matter, thanks.
Title: Re: IRC Client help
Post by: l2k-Shadow on August 15, 2007, 08:31 PM

FormName.Text1.Text = "Hello"


lol
Title: Re: IRC Client help
Post by: Severance on August 15, 2007, 08:52 PM
Lol, I know that, but do you know how to put incomming chat messages into the text box?
Title: Re: IRC Client help
Post by: Severance on August 15, 2007, 09:00 PM
Oh nvm, misunderstood for a sec. I got it now though. Thanks for the help.
Title: Re: IRC Client help
Post by: rabbit on August 15, 2007, 10:04 PM
http://www.irchelp.org/irchelp/rfc/rfc.html helps
Title: Re: IRC Client help
Post by: Severance on August 15, 2007, 10:26 PM
Thanks, I was looking for something like that.
Title: Re: IRC Client help
Post by: brew on August 16, 2007, 10:41 AM
For the output, that simple one-liner isn't going to be enough. I recommend you create a sort of an "AppendText" subroutine which does exactly that, appends the text you want to a multilined textbox. This can easily be done with the .SelStart, .SelText, and .SelLength properties. If you really have trouble with that, too, you should just use debug.print for now, or debug.append. Either works great. It seems that if you are having this much trouble with outputting data, you should work on this before creating a winsock application. Although it does kind of seem as if VB6 isn't your first programming language you've learned.... is this true?
Title: Re: IRC Client help
Post by: Severance on August 16, 2007, 11:09 AM
Well actually Im new to programming in general. I usually work with web design and fairly understand the language of php. But people have told me that you should start with VB if you want to learn application programming.
Title: Re: IRC Client help
Post by: rabbit on August 16, 2007, 11:17 AM
No.  Wrong.  Fail.  Start with C.
Title: Re: IRC Client help
Post by: Severance on August 16, 2007, 11:25 AM
Is that an easier language?
Title: Re: IRC Client help
Post by: rabbit on August 16, 2007, 12:22 PM
It's better.
Title: Re: IRC Client help
Post by: Barabajagal on August 16, 2007, 12:30 PM
No, VB is probably the easiest language to learn in existence, as well as the most common. The BASIC series was designed as an educational, or introductory language. However, most programmers never move beyond it now because all the other languages are 'too hard', and in reality, VB can do pretty much whatever most programmers want (although not in the most efficient or best ways). C is a more powerful, faster, and universal language. If you have enough willpower, take a VB class and learn VB... use it for 2 years or so, and when you've mastered the basics of application programming, learn another language such as PowerBASIC, C, C++, Java (if you want easy multi-os applications/web applets), etc...
Title: Re: IRC Client help
Post by: Severance on August 16, 2007, 01:06 PM
Sounds good, Ill try to keep all that in mind. Thanks.
Title: Re: IRC Client help
Post by: rabbit on August 16, 2007, 02:23 PM
Ignore Andy.  If you know PHP well enough, C will be easy.
Title: Re: IRC Client help
Post by: Severance on August 16, 2007, 05:23 PM
lol okay.
Title: Re: IRC Client help
Post by: FrOzeN on August 16, 2007, 11:51 PM
I completely agree with rabbit. Learn C first up, especially if you have some understanding of php. VB6 is easier to learn, but is completely impractical for anything more than hobby language. Also, if you were to learn VB6 first, you'll find that when you do want to move onto languages like C, that'll it'll be harder to pick them up because of bad programming skills VB6 teaches you.
Title: Re: IRC Client help
Post by: Hell-Lord on August 17, 2007, 01:35 AM
VB6 still has quite a big base in the programming world. Majority of it are programmers who refuse to change but a lot of businesses still use it. Obviously if you are fluent in a language like C then you are set for programming in almost every language.
Title: Re: IRC Client help
Post by: brew on August 17, 2007, 06:55 AM
Quote from: FrOzeN on August 16, 2007, 11:51 PM
Also, if you were to learn VB6 first, you'll find that when you do want to move onto languages like C, that'll it'll be harder to pick them up because of bad programming skills VB6 teaches you.
Vouch