![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2005
Posts: 1
Rep Power: 0
![]() |
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 FunctionLast edited by Tech; Aug 24th, 2005 at 11:33 PM. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Here's a tip: use [code] tags.
|
|
|
|
|
|
#3 | |
|
Expert Programmer
|
Quote:
![]() |
|
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Man, portage is there for a reason. Use it. Get Firefox.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
welcome
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#6 | |
|
Expert Programmer
|
Quote:
|
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Erm... KDE? GNOME? XCFE?
|
|
|
|
|
|
#8 | |
|
Expert Programmer
|
Quote:
![]() |
|
|
|
|
|
|
#9 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#10 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
![]() |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|