Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 24th, 2005, 11:04 PM   #1
Tech
Newbie
 
Join Date: Aug 2005
Posts: 1
Rep Power: 0 Tech is on a distinguished road
Hello Everyone

Im new here and i just started programming useing Visual Basic 6 and im making a Program for a p2p program that i use i am trying to make a userlist on the program i have the userlist so that it shows all of the user nams but the names show like this √т-Ŧech-мị² and i am tryin to get them to show like this √т-Ŧech-мị² so can any one help me on this here is the code i have for they userlist




. . . : : : Userlist Code : : : . . .
Public sCodePage As Long
Public cnvUni2 As String
Public cnvUni As String
Option Explicit


Function HexChrToDec(HexChr As String) As Integer
On Error Resume Next
HexChrToDec = Asc(Left(HexChr, 1)) + Asc(Right(HexChr, 1)) * 256
End Function

Private Sub Timer1_Timer()

On Error Resume Next
Dim Buffer As String
Dim Size As String
Dim recvSize As Integer
Dim I As Integer
Dim username As String
Dim OutputData As String
Dim joinname As String
Dim partname As String
Dim strData As String
Dim start As String




Winsock.GetData Size, vbString, 2
If Len(Size) > 0 Then
 recvSize = HexChrToDec(Size)
 
 Winsock.GetData Buffer, vbString, recvSize + 1
 Buffer = Size & Buffer
 
    Select Case Asc(Mid(Buffer, 3, 1))
 
Case 3 'Username And Verson Back
userlist.clear
 
   Case 30 'Userlist
   OutputData = Right(Buffer, Len(Buffer) - 3)
   For I = 23 To Len(OutputData)
   If Mid(Buffer, I, 1) = Chr(0) Then
   Exit For
   End If
   username = username & Mid(Buffer, I, 1)
   Next I
   userlist.AddItem username

    Case 20 'user join
OutputData = Right(Buffer, Len(Buffer) - 3)
jns.Text = (Mid(OutputData, 20))
ull.Text = DecodeUTF8(jns.Text)
userlist.AddItem ull
 
   Case 22 ' UserPart
   OutputData = Right(Buffer, Len(Buffer) - 3)
   partname = Replace(Mid(OutputData, 1), Chr(0), "")
   ull.Text = DecodeUTF8(partname)
      For I = 0 To userlist.ListCount - 1
        If userlist.List(I) = ull Then userlist.RemoveItem I
      Next I
 
End Select
Buffer = ""
Size = ""
End If
End Sub

Private Sub Cmdconnect_Click()
Winsock.Connect txtip.Text, txtport.Text
Form2.Width = 3960
End Sub


Private Sub cmdDissconnect_Click()
Winsock.Close
End Sub
Private Sub Winsock_Connect()
Winsock.SendData LogInPacket(txtname.Text, txtip.Text, 0, 24)
End Sub

Private Sub Form_Load()
sCodePage = CP_UTF8
End Sub

Function EncodeUTF8(ByVal cnvUni As String)
    If cnvUni = vbNullString Then Exit Function
    EncodeUTF8 = StrConv(WToA(cnvUni, sCodePage, 0), vbUnicode)
End Function
Function DecodeUTF8(ByVal cnvUni As String)

    If cnvUni = vbNullString Then Exit Function
    cnvUni2 = WToA(cnvUni, CP_ACP)
    DecodeUTF8 = AToW(cnvUni2, sCodePage)
End Function

Last edited by Tech; Aug 24th, 2005 at 11:33 PM.
Tech is offline   Reply With Quote
Old Aug 24th, 2005, 11:22 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Here's a tip: use [code] tags.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 26th, 2005, 11:10 PM   #3
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Quote:
Originally Posted by Ooble
Here's a tip: use [code] tags.
Makes no bloody difference on Links2!
Rory is offline   Reply With Quote
Old Aug 27th, 2005, 5:56 AM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Man, portage is there for a reason. Use it. Get Firefox.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 28th, 2005, 8:45 PM   #5
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
welcome
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 29th, 2005, 9:58 PM   #6
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Quote:
Originally Posted by Ooble
Man, portage is there for a reason. Use it. Get Firefox.
Firefox doesn't work command line! The internet looks really crappy in an 8 bit terminal.
Rory is offline   Reply With Quote
Old Aug 30th, 2005, 12:08 PM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Erm... KDE? GNOME? XCFE?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 7th, 2005, 2:20 PM   #8
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Quote:
Originally Posted by Ooble
Erm... KDE? GNOME? XCFE?
X.org is unecessary overhead
Rory is offline   Reply With Quote
Old Sep 7th, 2005, 4:52 PM   #9
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
How is it "unnecessary" if it improves your computing experience and you have the resources to support it?

Unnecessary maybe, but there's no good reason not to.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials.
--WilliamSChips on Slashdot
uman is offline   Reply With Quote
Old Sep 8th, 2005, 11:15 AM   #10
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Quote:
Originally Posted by uman
How is it "unnecessary" if it improves your computing experience and you have the resources to support it?

Unnecessary maybe, but there's no good reason not to.
Because he's psycho. Take it from me.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC