diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2821de5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,86 @@ +# VB6 source files (show diff + keep CRLF in zip download) + +*.bas working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.cls working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.ctl working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.dob working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.dsr working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.frm working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.pag working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6 +*.vbg working-tree-encoding=CP1252 text eol=crlf +*.vbl working-tree-encoding=CP1252 text eol=crlf +*.vbp working-tree-encoding=CP1252 text eol=crlf +*.vbr working-tree-encoding=CP1252 text eol=crlf +*.vbw working-tree-encoding=CP1252 text eol=crlf + +# Other source files (show diff + LF only in zip download) + +*.asm text +*.asp text +*.bat text +*.c text +*.cpp text +*.dsp text +*.dsw text +*.h text +*.idl text +*.java text +*.js text +*.manifest text +*.odl text +*.php text +*.php3 text +*.rc text +*.sln text +*.sql text +*.vb text +*.vbs text + +# Binary + +*.res binary +*.frx binary +*.ctx binary +*.dsx binary +*.exe binary +*.dll binary +*.ocx binary +*.cmp binary +*.pdb binary +*.tlb binary +*.xls binary +*.doc binary +*.ppt binary +*.xlsx binary +*.docx binary +*.pptx binary +*.chm binary +*.hlp binary +*.jpg binary +*.png binary +*.bmp binary +*.gif binary +*.ico binary +*.zip binary +*.cab binary +*.7z binary +*.gz binary + +# Text files but keep as binary (no diff) + +# *.cfg text +# *.conf text +# *.csi text +# *.css text +# *.csv text +# *.def text +# *.htm text +# *.html text +# *.inf text +# *.ini text +# *.log text +# *.reg text +# *.rtf text +# *.txt text +# *.url text +# *.xml text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ad71de --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.scc +*.dca +*.oca +*.obj +vb*.tmp +@PSC* diff --git a/Form1.frm b/Form1.frm new file mode 100644 index 0000000..8e7078c --- /dev/null +++ b/Form1.frm @@ -0,0 +1,647 @@ +VERSION 5.00 +Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX" +Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" +Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL" +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "InterChat" + ClientHeight = 2280 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4515 + Icon = "Form1.frx":0000 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 2280 + ScaleWidth = 4515 + StartUpPosition = 2 'CenterScreen + Begin VB.PictureBox Picture1 + Height = 2775 + Left = 0 + ScaleHeight = 2715 + ScaleWidth = 4455 + TabIndex = 1 + Top = 2400 + Width = 4515 + Begin SHDocVwCtl.WebBrowser web + Height = 2695 + Left = 0 + TabIndex = 2 + Top = 0 + Width = 4440 + ExtentX = 7832 + ExtentY = 4754 + ViewMode = 0 + Offline = 0 + Silent = 0 + RegisterAsBrowser= 0 + RegisterAsDropTarget= 1 + AutoArrange = 0 'False + NoClientEdge = 0 'False + AlignLeft = 0 'False + ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}" + Location = "" + End + End + Begin TabDlg.SSTab SSTab1 + Height = 2295 + Left = 0 + TabIndex = 0 + Top = 0 + Width = 4515 + _ExtentX = 7964 + _ExtentY = 4048 + _Version = 393216 + Tab = 2 + TabHeight = 520 + TabCaption(0) = "Connection" + TabPicture(0) = "Form1.frx":0CCA + Tab(0).ControlEnabled= 0 'False + Tab(0).Control(0)= "Frame2" + Tab(0).Control(0).Enabled= 0 'False + Tab(0).Control(1)= "Frame1" + Tab(0).Control(1).Enabled= 0 'False + Tab(0).Control(2)= "Option1" + Tab(0).Control(2).Enabled= 0 'False + Tab(0).Control(3)= "Option2" + Tab(0).Control(3).Enabled= 0 'False + Tab(0).ControlCount= 4 + TabCaption(1) = "Chat" + TabPicture(1) = "Form1.frx":0CE6 + Tab(1).ControlEnabled= 0 'False + Tab(1).Control(0)= "Console" + Tab(1).Control(0).Enabled= 0 'False + Tab(1).Control(1)= "Sender" + Tab(1).Control(1).Enabled= 0 'False + Tab(1).Control(2)= "SendButton" + Tab(1).Control(2).Enabled= 0 'False + Tab(1).ControlCount= 3 + TabCaption(2) = "Transfer" + TabPicture(2) = "Form1.frx":0D02 + Tab(2).ControlEnabled= -1 'True + Tab(2).Control(0)= "Image1" + Tab(2).Control(0).Enabled= 0 'False + Tab(2).Control(1)= "Frame3" + Tab(2).Control(1).Enabled= 0 'False + Tab(2).Control(2)= "Frame4" + Tab(2).Control(2).Enabled= 0 'False + Tab(2).Control(3)= "Frame5" + Tab(2).Control(3).Enabled= 0 'False + Tab(2).ControlCount= 4 + Begin VB.Frame Frame5 + Appearance = 0 'Flat + BorderStyle = 0 'None + Enabled = 0 'False + ForeColor = &H80000008& + Height = 735 + Left = 120 + TabIndex = 23 + Top = 360 + Width = 2895 + Begin VB.OptionButton Option3 + Caption = "I Would Like To Send A File" + Height = 255 + Left = 120 + TabIndex = 25 + Top = 120 + Value = -1 'True + Width = 2295 + End + Begin VB.OptionButton Option4 + Caption = "I Would Like To Send A Picture" + Height = 255 + Left = 120 + TabIndex = 24 + Top = 360 + Width = 2655 + End + End + Begin VB.CommandButton SendButton + Caption = "Send" + Enabled = 0 'False + BeginProperty Font + Name = "MS Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 285 + Left = -71400 + TabIndex = 12 + Top = 1860 + Width = 735 + End + Begin VB.TextBox Sender + Enabled = 0 'False + Height = 285 + Left = -74880 + TabIndex = 11 + Top = 1860 + Width = 3375 + End + Begin VB.TextBox Console + Enabled = 0 'False + Height = 1335 + Left = -74880 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 10 + Top = 400 + Width = 4215 + End + Begin VB.OptionButton Option2 + Caption = "I Will Act As The Guest For This Connection Session" + Height = 255 + Left = -74760 + TabIndex = 4 + ToolTipText = " You Will Connect To The Host Of This Session " + Top = 900 + Width = 4095 + End + Begin VB.OptionButton Option1 + Caption = "I Will Act As The Host For This Connection Session" + Height = 255 + Left = -74760 + TabIndex = 3 + ToolTipText = " You Will Host This Session. The Guest Will Connect To You " + Top = 540 + Value = -1 'True + Width = 3975 + End + Begin VB.Frame Frame1 + Caption = "Host" + Height = 735 + Left = -74760 + TabIndex = 5 + Top = 1260 + Width = 4095 + Begin VB.CommandButton Command1 + Caption = "Await Connection From Guest" + Height = 255 + Left = 240 + TabIndex = 6 + ToolTipText = " Await Connection From The Guest " + Top = 300 + Width = 3615 + End + End + Begin VB.Frame Frame4 + Caption = "Send File" + Enabled = 0 'False + Height = 975 + Left = 180 + TabIndex = 18 + Top = 1080 + Width = 4095 + Begin VB.TextBox Text3 + Enabled = 0 'False + Height = 285 + Left = 120 + TabIndex = 21 + Top = 600 + Width = 2535 + End + Begin VB.CommandButton Command6 + Caption = "Browse" + BeginProperty Font + Name = "MS Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 285 + Left = 2760 + TabIndex = 20 + Top = 240 + Width = 1215 + End + Begin VB.CommandButton Command5 + Caption = "Send" + BeginProperty Font + Name = "MS Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 285 + Left = 2760 + TabIndex = 19 + Top = 600 + Width = 1215 + End + Begin MSComDlg.CommonDialog CommonDialog1 + Left = 2040 + Top = 240 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.Label Label2 + Caption = "File Location && Name" + Height = 195 + Left = 120 + TabIndex = 22 + Top = 300 + Width = 1755 + End + End + Begin VB.Frame Frame3 + Caption = "Send Picture" + Enabled = 0 'False + Height = 975 + Left = 180 + TabIndex = 13 + Top = 1080 + Width = 4095 + Begin MSComDlg.CommonDialog cmd + Left = 2040 + Top = 240 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.CommandButton Command4 + Caption = "Send" + BeginProperty Font + Name = "MS Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 285 + Left = 2760 + TabIndex = 17 + Top = 600 + Width = 1215 + End + Begin VB.CommandButton Command3 + Caption = "Browse" + BeginProperty Font + Name = "MS Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 285 + Left = 2760 + TabIndex = 16 + Top = 240 + Width = 1215 + End + Begin VB.TextBox Text2 + Enabled = 0 'False + Height = 285 + Left = 120 + TabIndex = 15 + Top = 600 + Width = 2535 + End + Begin VB.Label Label1 + Caption = "Picture Location && Name" + Height = 195 + Left = 120 + TabIndex = 14 + Top = 300 + Width = 1755 + End + End + Begin VB.Frame Frame2 + Caption = "Guest" + Height = 735 + Left = -74760 + TabIndex = 7 + Top = 1260 + Visible = 0 'False + Width = 4095 + Begin VB.TextBox Text1 + Alignment = 2 'Center + Height = 285 + Left = 120 + TabIndex = 9 + Text = "000.000.000.000" + ToolTipText = " The Internet Protocol (IP) Number Of The Host To Connect To " + Top = 280 + Width = 1575 + End + Begin VB.CommandButton Command2 + Caption = "Connect To Host" + Height = 255 + Left = 2040 + TabIndex = 8 + ToolTipText = " Click Here To Connect To The Host " + Top = 300 + Width = 1815 + End + End + Begin VB.Image Image1 + Appearance = 0 'Flat + BorderStyle = 1 'Fixed Single + Height = 615 + Left = 3120 + Stretch = -1 'True + Top = 420 + Visible = 0 'False + Width = 1145 + End + End + Begin MSWinsockLib.Winsock Chat + Left = 480 + Top = 0 + _ExtentX = 741 + _ExtentY = 741 + _Version = 393216 + End + Begin MSWinsockLib.Winsock Transfer + Left = 0 + Top = 0 + _ExtentX = 741 + _ExtentY = 741 + _Version = 393216 + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False + +Private Sub Chat_Close() +Console.Enabled = False +Sender.Enabled = False +SendButton.Enabled = False +Frame5.Enabled = False +Frame4.Enabled = False +Frame3.Enabled = False +End Sub + +Private Sub Chat_Connect() +web.Navigate "http://" & Chat.RemoteHostIP +SSTab1.Tab = 1 +Frame5.Enabled = True +Frame4.Enabled = True +Frame3.Enabled = True +Console.Enabled = True +Sender.Enabled = True +SendButton.Enabled = True +Sender.SetFocus +End Sub + +Private Sub Chat_ConnectionRequest(ByVal requestID As Long) +Chat.Close +Chat.Accept requestID +web.Navigate "http://" & Chat.RemoteHostIP +SSTab1.Tab = 1 +Frame5.Enabled = True +Frame4.Enabled = True +Frame3.Enabled = True +Console.Enabled = True +Sender.Enabled = True +SendButton.Enabled = True +Sender.SetFocus +End Sub + + +Private Sub Chat_DataArrival(ByVal bytesTotal As Long) +Dim strData As String +Chat.GetData strData +If strData = "*PICREQUEST*" Then +web.Refresh +Form1.Height = 5565 +Exit Sub +End If +Console.Text = Console.Text & vbCrLf & strData +Console.SetFocus +Console.SelStart = Len(Console.Text) +Sender.SetFocus +End Sub + +Private Sub Command1_Click() +Chat.Close +Chat.LocalPort = CLng(187) +Chat.Listen +End Sub + +Private Sub Command2_Click() +On Error GoTo erh +Chat.Close +Chat.Connect Text1.Text, 187 +Exit Sub +erh: +MsgBox "The server is not accepting connection requests at this time." +Chat.Close +Exit Sub +End Sub + + +Private Sub Command3_Click() +On Error GoTo erh +cmd.DialogTitle = "Picture To Send..." +cmd.Filename = "*.jpg;*.gif" +cmd.InitDir = CurDir +cmd.Filter = "JPG & GIF Files (*.jpg;*.gif)" +cmd.ShowOpen +Dim sFile As String, sShortFile As String * 67 +Dim lRet As Long +sFile = cmd.Filename +lRet = GetShortPathName(sFile, sShortFile, Len(sShortFile)) +sFile = Left(sShortFile, lRet) +Text2.Text = sFile +Image1.Picture = LoadPicture(Text2.Text) +erh: +Exit Sub +End Sub + +Private Sub Command4_Click() +If Text2.Text = "" Then +MsgBox "Select A Picture To Send." +Command3_Click +Exit Sub +End If +Transfer.Close +Transfer.LocalPort = CLng(80) +Transfer.Listen +Chat.SendData "*PICREQUEST*" + +End Sub + + +Private Sub Command5_Click() +If Text3.Text = "" Then +MsgBox "Select A File To Send." +Command6_Click +Exit Sub +End If +Transfer.Close +Transfer.LocalPort = CLng(80) +Transfer.Listen +Chat.SendData "*PICREQUEST*" + +End Sub + +Private Sub Command6_Click() +'On Error GoTo erh +cmd.DialogTitle = "File To Send..." +cmd.Filename = "*.zip;*.rar" +cmd.InitDir = CurDir +cmd.Filter = "WinZIP & WinRAR Files (*.zip;*.rar)" +cmd.ShowOpen +Dim sFile As String, sShortFile As String * 67 +Dim lRet As Long +sFile = cmd.Filename +lRet = GetShortPathName(sFile, sShortFile, Len(sShortFile)) +sFile = Left(sShortFile, lRet) +Text3.Text = sFile +erh: +Exit Sub +End Sub + +Private Sub Form_Load() +Show +Form1.Caption = "InterChat - ( " & CurrentIP(True) & " )" +End Sub + +Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) +On Error Resume Next +Chat.Close +Transfer.Close +Unload Me +End +End Sub + + +Private Sub Form_Terminate() +On Error Resume Next +Chat.Close +Transfer.Close +Unload Me +End +End Sub + + +Private Sub Form_Unload(Cancel As Integer) +On Error Resume Next +Chat.Close +Transfer.Close +Unload Me +End +End Sub + + +Private Sub Option1_Click() +Frame1.Visible = True +Frame2.Visible = False +Command1.SetFocus +End Sub + + +Private Sub Option2_Click() +Frame2.Visible = True +Frame1.Visible = False +Text1.SetFocus +Text1.SelStart = 0 +Text1.SelLength = Len(Text1.Text) +End Sub + + +Private Sub Option3_Click() +Image1.Enabled = False +Frame3.Visible = False +Frame4.Visible = True +Command6_Click +End Sub + +Private Sub Option4_Click() +Frame3.Visible = True +Frame4.Visible = False +Image1.Picture = LoadPicture() +Image1.Visible = True +Command3_Click +End Sub + +Private Sub SendButton_Click() +Dim strData As String +strData = Chat.LocalHostName & ": " & Sender.Text +Chat.SendData strData +Console.Text = Console.Text & vbCrLf & strData +Console.SetFocus +Console.SelStart = Len(Console.Text) +Sender.Text = "" +Sender.SetFocus +End Sub + + +Private Sub Sender_KeyPress(KeyAscii As Integer) +If KeyAscii = 13 Then +SendButton_Click +KeyAscii = 0 +Exit Sub +End If +End Sub + + +Private Sub SSTab1_Click(PreviousTab As Integer) +On Error Resume Next +If SSTab1.Tab = 1 Then Sender.SetFocus +End Sub + +Private Sub Text1_KeyPress(KeyAscii As Integer) +If KeyAscii = 13 Then +Command2_Click +KeyAscii = 0 +Exit Sub +End If +End Sub + + +Private Sub Transfer_ConnectionRequest(ByVal requestID As Long) +Transfer.Close +Transfer.Accept requestID +End Sub + +Private Sub Transfer_DataArrival(ByVal bytesTotal As Long) +On Error Resume Next +If Option4.Value = True Then +f = FreeFile +temp = "" +Open Text2.Text For Binary As #f + temp = Input(FileLen(Text2.Text), #f) +Close #f +getimg = temp +Transfer.SendData getimg +End If +If Option3.Value = True Then +f = FreeFile +temp = "" +Open Text3.Text For Binary As #f + temp = Input(FileLen(Text3.Text), #f) +Close #f +getimg = temp +Transfer.SendData getimg +End If +End Sub + + +Private Sub Transfer_SendComplete() +Transfer.Close +SSTab1.Tab = 1 +Chat.SendData "***Transfer Complete" +End Sub + + diff --git a/Form1.frx b/Form1.frx new file mode 100644 index 0000000..d06cc27 Binary files /dev/null and b/Form1.frx differ diff --git a/MattsBAS.bas b/MattsBAS.bas new file mode 100644 index 0000000..2769d8b --- /dev/null +++ b/MattsBAS.bas @@ -0,0 +1,309 @@ +Attribute VB_Name = "MattsBAS" +Public a As Long +Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) _ + As Long +Public lShowCursor As Long +Public lRet As Long +Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) +Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long +Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long +Public Const SND_SYNC = &H0 +Public Const SND_ASYNC = &H1 +Public Const SND_NODEFAULT = &H2 +Public Const SND_MEMORY = &H4 +Public Const SND_ALIAS = &H10000 +Public Const SND_FILENAME = &H20000 +Public Const SND_RESOURCE = &H40004 +Public Const SND_ALIAS_ID = &H110000 +Public Const SND_ALIAS_START = 0 +Public Const SND_LOOP = &H8 +Public Const SND_NOSTOP = &H10 +Public Const SND_VALID = &H1F +Public Const SND_NOWAIT = &H2000 +Public Const SND_VALIDFLAGS = &H17201F + +Public Const SND_RESERVED = &HFF000000 +Public Const SND_TYPE_MASK = &H170007 + +Public RAN As Long + + +Sub CollideDetection(ObjectHitting As Object, ObjectBeingHit As Object) +a = a + 1 +If a = 36 Then a = 0 +If ObjectHitting.Left + ObjectHitting.Width > ObjectBeingHit(a).Left Then + If ObjectHitting.Left < ObjectBeingHit(a).Left + ObjectBeingHit(a).Width Then + If ObjectHitting.Top < ObjectBeingHit(a).Top + ObjectBeingHit(a).Height Then + If ObjectHitting.Top + ObjectHitting.Height > ObjectBeingHit(a).Top Then + MsgBox "DOOMED!" + End If + End If + End If + End If + +End Sub + + +Public Sub HideMouse() + Do + lShowCursor = lShowCursor - 1 + lRet = ShowCursor(False) + Loop Until lRet < 0 +End Sub + +Sub LoadTextToList(Filename As String, lst As ListBox) +Dim aLine As String +Open Filename For Input As 1 +Do Until EOF(1) + Line Input #1, aLine + If Trim$(aLine) <> "" Then lst.AddItem aLine +Loop +Close 1 +End Sub + + +Sub NotOnTop(the As Form) +SetWinOnTop = SetWindowPos(the.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags) +End Sub + + +Sub ParseList(StringToRemove As String, lst As ListBox) +Dim X As Integer +Dim Search, Where +lst.ListIndex = -1 +On Error GoTo erh +Do +Start: +lst.ListIndex = lst.ListIndex + 1 +Search = StringToRemove +Where = InStr(lst.Text, StringToRemove) +If Where Then GoTo Start +lst.RemoveItem lst.ListIndex +Loop Until lst.ListIndex = lst.ListCount - 1 +erh: +Exit Sub +End Sub + +Sub playwav(File) +SoundName$ = File +SoundFlags& = &H20000 Or &H1 +snd& = sndPlaySound(SoundName$, SoundFlags&) +End Sub +Sub AddToList(lst As ListBox, Str As String) +lst.AddItem Str +End Sub + + +Sub CenterForm(Frm As Form) +Frm.Top = Screen.Height / 2 - Frm.Height / 2 +Frm.Left = Screen.Width / 2 - Frm.Width / 2 +End Sub + + +Sub CMDShowOpen(cmd As Control, DiagTitle As String, Filename As String, Directory As String, Filter As String) +cmd.DialogTitle = DiagTitle +cmd.Filename = Filename +cmd.InitDir = Directory +cmd.Filter = Filter +cmd.ShowOpen +End Sub + +Sub CMDShowSave(cmd As Control, DiagTitle As String, Filename As String, Directory As String, Filter As String) +cmd.DialogTitle = DiagTitle +cmd.Filename = Filename +cmd.InitDir = Directory +cmd.Filter = Filter +cmd.ShowSave +End Sub + +Sub CopyFile(SrcFile As String, DestFile As String) +Dim sourcefile As String +Dim destinationfile As String +sourcefile = SrcFile +destinationfile = DestFile +FileCopy sourcefile, destinationfile +End Sub + +Sub FullScreen(Frm As Form) +Frm.Move 0, 0, Screen.Width, Screen.Height +End Sub + + +Sub HighlightMe(Txt As TextBox) +Txt.SelStart = 0 +Txt.SelLength = Len(Txt.Text) +End Sub + +Sub ImageToClip(ImgBox As Image) +Clipboard.Clear +Clipboard.SetData ImgBox.Picture, vbCFBitmap +End Sub + +Sub LoadNewControl(Ctrl As Control, Left As Integer, Top As Integer, Indx As Integer, Visibility As Boolean) +Load Ctrl(Indx) +Ctrl(Indx).Left = Left +Ctrl(Indx).Top = Top +Ctrl(Indx).Visible = Visibility +End Sub + +Sub LoadTXTtoList(Filename As String, lst As ListBox) +Dim aLine As String +Open Filename For Input As 1 +Do Until EOF(1) + Line Input #1, aLine + If Trim$(aLine) <> "" Then lst.AddItem aLine +Loop +Close 1 +End Sub + +Sub MB(message As String) +MsgBox message +End Sub + +Sub MenuBarLine(Fram As Frame) +Fram.Width = Screen.Width + 100 +Fram.Move -50, 0 +End Sub + +Sub MPpause(MP As Control) +MP.Pause +End Sub + +Sub MPplay(MP As Control) +MP.play + +End Sub + +Sub MPstop(MP As Control) +MP.Stop +End Sub + +Sub MSCOMMdial(MSc As Control, ThePort As Integer, NumberToDial As Integer) +On Error Resume Next +MSc.commport = ThePort +MSc.PortOpen = True +PhoneNumber$ = NumberToDial +MSc.Output = "ATD" + PhoneNumber$ + Chr$(13) +End Sub + +Sub MSCOMMhangup(MSc As Control) +MSc.PortOpen = False +End Sub + +Sub NextListIndex(lst As ListBox) +On Error Resume Next +lst.ListIndex = lst.ListIndex + 1 +End Sub + +Sub OpenExe(FileNameAndPath As String) +Result = Shell("start.exe " & FileNameAndPath, vbHide) +End Sub + + +Sub OpenTXT(Filename As String, Txt As TextBox) + Dim a As String + Open Filename For Input As 1 + a = Input(LOF(1), 1) + Close 1 + Txt = a +End Sub + +Sub PicImageToClip(PicBox As PictureBox) +Clipboard.SetData PicBox.Picture, vbCFBitmap +End Sub + +Sub PicToClip(PicBox As PictureBox) +Clipboard.Clear +Clipboard.SetData PicBox.Picture, vbCFBitmap +End Sub + +Sub PrevListIndex(lst As ListBox) +On Error Resume Next +lst.ListIndex = lst.ListIndex - 1 +End Sub + +Sub RandomIt(Total As Integer) +RAN = 0 +Randomize +RAN = Int(Total * Rnd + 1) +'RandomIt (10) +'MsgBox ran + +End Sub + +Sub RemoveFromList(lst As ListBox, LstIndex As Integer) +lst.RemoveItem lst.ListIndex +End Sub + +Sub RetrieveHTML(Inet As Control, url As String, Filename As String) +Dim X +Dim strsource +strsource = Inet.OpenUrl(url) +X = Filename +Open X For Output As #1 +Print #1, strsource +Close #1 +End Sub + +Sub SaveTXT(Filename As String, Txt As TextBox) +X = Filename +Open X For Output As #1 +Print #1, Txt.Text +Close #1 + +End Sub + +Sub Scroll2Bottom(Txt As TextBox) +Txt.SelStart = Len(Txt.Text) +End Sub + +Sub SearchAndHiLite(TextToSearchFor As String, WhereToSearch As TextBox) +Dim Search, Where +Search = TextToSearchFor +Where = InStr(WhereToSearch.Text, Search) +If Where Then +WhereToSearch.SelStart = Where - 1 +WhereToSearch.SelLength = Len(Search) +End If +End Sub + +Public Sub ShowMouse() + Do + lShowCursor = lShowCursor - 1 + lRet = ShowCursor(True) + Loop Until lRet >= 0 +End Sub + +Sub StayOnTop(the As Form) +SetWinOnTop = SetWindowPos(the.hwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, Flags) +End Sub + +Sub StopAll() +Do +DoEvents +Loop +End Sub + + +Sub WSclose(WS As Control) +WS.Close +End Sub + +Sub WSconnect(WS As Control, IP As String, Port As Integer) +WS.Close +WS.Connect IP, Port +End Sub + + +Sub WSlisten(WS As Control, Port As Integer) +WS.Close +WS.LocalPort = CLng(Port) +WS.Listen +End Sub + + +Sub WSsend(WS As Control, TextToSend As String) +WS.SendData TextToSend +End Sub + + diff --git a/Module1.bas b/Module1.bas new file mode 100644 index 0000000..6b6cd57 --- /dev/null +++ b/Module1.bas @@ -0,0 +1,6 @@ +Attribute VB_Name = "Module1" +Declare Function GetShortPathName Lib "kernel32" Alias _ + "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal _ + lpszShortPath As String, ByVal cchBuffer As Long) As Long + + diff --git a/Project1.PDM b/Project1.PDM new file mode 100644 index 0000000..9bd01a6 --- /dev/null +++ b/Project1.PDM @@ -0,0 +1,302 @@ +[Root] +Most Recent Package=IC1 + + +[Package|InterChat|Root] +SubWizProgID=PDWizard.SetupPkgSubWiz +BuildFolder=C:\VBSTUFF\MattsChatProg + +[Package|InterChat|Configure DAO ISAMs] +Applicable=No + +[Package|InterChat|Configure DAO ODBC] +JetWorkspace= +ODBCDirect= + +[Package|InterChat|Files Found] + +[Package|InterChat|Files Released] + +[Package|InterChat|Missing Dependency Information] + +[Package|InterChat|Out-of-Date Dependency Information] + +[Package|InterChat|Files Added] +C:\InterChat\Receive.wav= +C:\InterChat\Send.wav= + +[Package|InterChat|Files Removed] + +[Package|InterChat|Files In Project] +C:\InterChat\InterChat.exe=Yes +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=Yes +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=Yes +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=Yes +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=Yes +C:\WINDOWS\SYSTEM\STDOLE2.TLB=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=Yes +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=Yes +C:\WINDOWS\SYSTEM\TABCTL32.OCX=Yes +C:\WINDOWS\SYSTEM\COMDLG32.OCX=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=Yes +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=Yes +C:\InterChat\Receive.wav=Yes +C:\InterChat\Send.wav=Yes + +[Package|InterChat|Configure Registry Files] +Applicable=No + +[Package|InterChat|Configure Remote Servers] +Applicable=No + +[Package|InterChat|Install Locations] +C:\InterChat\InterChat.exe=$(AppPath) +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\STDOLE2.TLB=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\TABCTL32.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\COMDLG32.OCX=$(WinSysPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=$(AppPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=$(WinPath) +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=$(WinPath) +C:\InterChat\Receive.wav=$(AppPath) +C:\InterChat\Send.wav=$(AppPath) + +[Package|InterChat|Configure Shared Files] +Applicable=Yes +C:\InterChat\InterChat.exe=No +C:\InterChat\Receive.wav=No +C:\InterChat\Send.wav=No + +[Package|InterChat|Distribution] +Type=single +Size= +Title=InterChat v1.0 + +[Package|InterChat|IconGroups] +Group0=InterChat +PrivateGroup0=False +Parent0=$(Programs) + +[Package|InterChat|InterChat] +Icon1=InterChat.exe +Title1=InterChat v1.0 +StartIn1=$(AppPath) +Key1=Icon5 + +[Package|InterChat|Package] +PackageFolder=C:\VBSTUFF\MattsChatProg +ProjectFolder=C:\VBSTUFF\MattsChatProg +ServerSideCab= +File1=C:\VBSTUFF\MattsChatProg\setup.exe +File2=C:\VBSTUFF\MattsChatProg\Setup.Lst +File3=C:\VBSTUFF\MattsChatProg\InterChat.CAB +Handler1=PDWizard.FolderDplySubWiz +Handler2=PDWizard.WebPostDplySubWiz + + +[Package|InterChat2|Root] +SubWizProgID=PDWizard.SetupPkgSubWiz +BuildFolder=C:\WINDOWS\Desktop\InterChat + +[Package|InterChat2|Configure DAO ISAMs] +Applicable=No + +[Package|InterChat2|Configure DAO ODBC] +JetWorkspace= +ODBCDirect= + +[Package|InterChat2|Files Found] +Receive.wav=C:\WINDOWS\Desktop\InterChat\Receive.wav +Send.wav=C:\WINDOWS\Desktop\InterChat\Send.wav + +[Package|InterChat2|Files Released] + +[Package|InterChat2|Missing Dependency Information] + +[Package|InterChat2|Out-of-Date Dependency Information] + +[Package|InterChat2|Files Added] +receive.wav= +send.wav= + +[Package|InterChat2|Files Removed] + +[Package|InterChat2|Files In Project] +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=Yes +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=Yes +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=Yes +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=Yes +C:\WINDOWS\SYSTEM\STDOLE2.TLB=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=Yes +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=Yes +C:\WINDOWS\SYSTEM\TABCTL32.OCX=Yes +C:\WINDOWS\SYSTEM\COMDLG32.OCX=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=Yes +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=Yes +C:\VBSTUFF\MattsChatProg\InterChat.exe=Yes +C:\WINDOWS\Desktop\InterChat\Receive.wav=Yes +C:\WINDOWS\Desktop\InterChat\Send.wav=Yes + +[Package|InterChat2|Configure Registry Files] +Applicable=No + +[Package|InterChat2|Configure Remote Servers] +Applicable=No + +[Package|InterChat2|Install Locations] +C:\InterChat\InterChat.exe=$(AppPath) +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\STDOLE2.TLB=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\TABCTL32.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\COMDLG32.OCX=$(WinSysPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=$(AppPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=$(WinPath) +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=$(WinPath) +C:\InterChat\Receive.wav=$(AppPath) +C:\InterChat\Send.wav=$(AppPath) +C:\VBSTUFF\MattsChatProg\InterChat.exe=$(AppPath) +C:\WINDOWS\Desktop\InterChat\Receive.wav=$(AppPath) +C:\WINDOWS\Desktop\InterChat\Send.wav=$(AppPath) + +[Package|InterChat2|Configure Shared Files] +Applicable=Yes +C:\InterChat\InterChat.exe=No +C:\InterChat\Receive.wav=No +C:\InterChat\Send.wav=No +C:\VBSTUFF\MattsChatProg\InterChat.exe=No +C:\WINDOWS\Desktop\InterChat\Receive.wav=No +C:\WINDOWS\Desktop\InterChat\Send.wav=No + +[Package|InterChat2|Distribution] +Type=single +Size= +Title=InterChat v1.0 + +[Package|InterChat2|Package] +PackageFolder=C:\WINDOWS\Desktop\InterChat +ProjectFolder=C:\VBSTUFF\MattsChatProg +ServerSideCab= +File1=C:\WINDOWS\Desktop\InterChat\setup.exe +File2=C:\WINDOWS\Desktop\InterChat\Setup.Lst +File3=C:\WINDOWS\Desktop\InterChat\InterChat.CAB +Handler1=PDWizard.FolderDplySubWiz +Handler2=PDWizard.WebPostDplySubWiz + +[Package|InterChat2|IconGroups] +Group0=InterChat +PrivateGroup0=False +Parent0=$(Programs) + +[Package|InterChat2|InterChat] +Icon1=InterChat.exe +Title1=InterChat v1.0 +StartIn1=$(AppPath) +Key1=Icon5 + + +[Package|IC1|Root] +SubWizProgID=PDWizard.SetupPkgSubWiz +BuildFolder=C:\WINDOWS\Desktop\InterChat + +[Package|IC1|Configure DAO ISAMs] +Applicable=No + +[Package|IC1|Configure DAO ODBC] +JetWorkspace= +ODBCDirect= + +[Package|IC1|Files Found] + +[Package|IC1|Files Released] + +[Package|IC1|Missing Dependency Information] + +[Package|IC1|Out-of-Date Dependency Information] + +[Package|IC1|Files Added] + +[Package|IC1|Files Removed] + +[Package|IC1|Files In Project] +C:\VBSTUFF\MattsChatProg\InterChat.exe=Yes +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=Yes +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=Yes +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=Yes +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=Yes +C:\WINDOWS\SYSTEM\STDOLE2.TLB=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=Yes +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=Yes +C:\WINDOWS\SYSTEM\TABCTL32.OCX=Yes +C:\WINDOWS\SYSTEM\COMDLG32.OCX=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=Yes +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=Yes +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=Yes + +[Package|IC1|Configure Registry Files] +Applicable=No + +[Package|IC1|Configure Remote Servers] +Applicable=No + +[Package|IC1|Install Locations] +C:\VBSTUFF\MattsChatProg\InterChat.exe=$(AppPath) +C:\WINDOWS\SYSTEM\MSVBVM60.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEAUT32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\OLEPRO32.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\ASYCFILT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\STDOLE2.TLB=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist\COMCAT.DLL=$(WinSysPathSysFile) +C:\WINDOWS\SYSTEM\MSWINSCK.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\TABCTL32.OCX=$(WinSysPath) +C:\WINDOWS\SYSTEM\COMDLG32.OCX=$(WinSysPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP.EXE=$(AppPath) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\SETUP1.EXE=$(WinPath) +C:\WINDOWS\SYSTEM\VB6STKIT.DLL=$(WinSysPathSysFile) +C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ST6UNST.EXE=$(WinPath) + +[Package|IC1|Configure Shared Files] +Applicable=Yes +C:\VBSTUFF\MattsChatProg\InterChat.exe=No + +[Package|IC1|Distribution] +Type=single +Size= +Title=InterChat v1.0 + +[Package|IC1|IconGroups] +Group0=InterChat +PrivateGroup0=True +Parent0=$(Programs) + +[Package|IC1|InterChat] +Icon1=InterChat.exe +Title1=InterChat v1.0 +StartIn1=$(AppPath) +Key1=Icon1 + +[Package|IC1|Package] +PackageFolder=C:\WINDOWS\Desktop\InterChat +ProjectFolder=C:\VBSTUFF\MattsChatProg +ServerSideCab= +File1=C:\WINDOWS\Desktop\InterChat\setup.exe +File2=C:\WINDOWS\Desktop\InterChat\Setup.Lst +File3=C:\WINDOWS\Desktop\InterChat\InterChat.CAB +Handler1=PDWizard.FolderDplySubWiz +Handler2=PDWizard.WebPostDplySubWiz diff --git a/Project1.vbp b/Project1.vbp new file mode 100644 index 0000000..3c28ece --- /dev/null +++ b/Project1.vbp @@ -0,0 +1,43 @@ +Type=Exe +Form=Form1.frm +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\WINDOWS\SYSTEM\STDOLE2.TLB#OLE Automation +Object={248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0; MSWINSCK.OCX +Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX +Object={EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0; SHDOCVW.DLL +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Module=Module1; Module1.bas +Module=MattsBAS; MattsBAS.bas +Module=XMessagerIPbas; ip.bas +IconForm="Form1" +Startup="Form1" +HelpFile="" +Title="InterChat" +ExeName32="InterChat.exe" +Command32="" +Name="Project1" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Surreal Entertainment Software" +VersionFileDescription="Chat/File Transfer Application" +VersionLegalCopyright="©Copyright 2000, Surreal Entertainment Software" +VersionProductName="InterChat" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 diff --git a/Project1.vbw b/Project1.vbw new file mode 100644 index 0000000..b617a4c --- /dev/null +++ b/Project1.vbw @@ -0,0 +1,4 @@ +Form1 = 41, 107, 423, 459, C, 85, 43, 430, 279, C +Module1 = 154, 154, 536, 506, C +MattsBAS = 0, 0, 0, 0, C +XMessagerIPbas = 0, 0, 0, 0, C diff --git a/README.md b/README.md new file mode 100644 index 0000000..8dd444e --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +
+ +## A Better IP Chat + + +
+ +### Description + +''InterChat'', as I've come to call it, connects 2 people via tcp/ip. With the options to Connect, Chat, and Transfer either Pictures or Files, this tabbed interface makes it easy to use, and the code is not hard to understand for the Experience level I have chosen. Please Vote. + +### More Info + + + + | +--- |--- +**Submitted On** |2000-11-10 09:38:32 +**By** |[CovertLoop](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByAuthor/covertloop.md) +**Level** |Intermediate +**User Rating** |3.8 (75 globes from 20 users) +**Compatibility** |VB 5\.0, VB 6\.0 +**Category** |[Internet/ HTML](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByCategory/internet-html__1-34.md) +**World** |[Visual Basic](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByWorld/visual-basic.md) +**Archive File** |[CODE\_UPLOAD1154611102000\.zip](https://github.com/Planet-Source-Code/covertloop-a-better-ip-chat__1-12685/archive/master.zip) + + + + + + + + diff --git a/ip.bas b/ip.bas new file mode 100644 index 0000000..a01e60b --- /dev/null +++ b/ip.bas @@ -0,0 +1,154 @@ +Attribute VB_Name = "XMessagerIPbas" + +' ********************************************************* +' * Code was not originally written by me (Master Yoda). * +' * I didn't spend a lot of time to fixed up this code so * +' * feel free to do so if nessesary. * +' ********************************************************* + +Public Const WS_VERSION_REQD = &H101 +Public Const WS_VERSION_MAJOR = WS_VERSION_REQD \ &H100 And &HFF& +Public Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF& +Public Const MIN_SOCKETS_REQD = 1 +Public Const SOCKET_ERROR = -1 +Public Const WSADescription_Len = 256 +Public Const WSASYS_Status_Len = 128 + +Public Type HOSTENT + hName As Long + hAliases As Long + hAddrType As Integer + hLength As Integer + hAddrList As Long +End Type + +Public Type WSADATA + wversion As Integer + wHighVersion As Integer + szDescription(0 To WSADescription_Len) As Byte + szSystemStatus(0 To WSASYS_Status_Len) As Byte + iMaxSockets As Integer + iMaxUdpDg As Integer + lpszVendorInfo As Long +End Type + +Public Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long +Public Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired&, lpWSAData As WSADATA) As Long +Public Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long +Public Declare Function gethostname Lib "WSOCK32.DLL" (ByVal hostname$, ByVal HostLen As Long) As Long +Public Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal hostname$) As Long +Public Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&) + +Function hibyte(ByVal wParam As Integer) + hibyte = wParam \ &H100 And &HFF& +End Function + + +Function lobyte(ByVal wParam As Integer) + lobyte = wParam And &HFF& +End Function + + +Sub SocketsInitialize() + Dim WSAD As WSADATA + Dim iReturn As Integer + Dim sLowByte As String, sHighByte As String, sMsg As String + iReturn = WSAStartup(WS_VERSION_REQD, WSAD) + + + If iReturn <> 0 Then + MsgBox "Winsock.dll Error." + Exit Sub + End If + If lobyte(WSAD.wversion) < WS_VERSION_MAJOR Or (lobyte(WSAD.wversion) = _ + WS_VERSION_MAJOR And hibyte(WSAD.wversion) < WS_VERSION_MINOR) Then + sHighByte = Trim$(Str$(hibyte(WSAD.wversion))) + sLowByte = Trim$(Str$(lobyte(WSAD.wversion))) + sMsg = "Windows Sockets version " & sLowByte & "." & sHighByte + 'sMsg = sMsg & " winsock.dll tarafindan desteklenmiyor. " + MsgBox sMsg + Exit Sub + End If + +End Sub + +Public Function CurrentIP(ReturnExternalIP As Boolean) + Dim hostname As String * 256 + Dim hostent_addr As Long + Dim host As HOSTENT + Dim hostip_addr As Long + Dim temp_ip_address() As Byte + Dim i As Integer + Dim ip_address As String + Dim IP As String + + If gethostname(hostname, 256) = SOCKET_ERROR Then + 'Form1.label1.Caption = Form1.Winsock1.LocalIP + 'Form1.Hide + Exit Function + Else + hostname = Trim$(hostname) + End If + hostent_addr = gethostbyname(hostname) + + + If hostent_addr = 0 Then + MsgBox "Winsock.dll error." + Exit Function + End If + RtlMoveMemory host, hostent_addr, LenB(host) + RtlMoveMemory hostip_addr, host.hAddrList, 4 + + Do + ReDim temp_ip_address(1 To host.hLength) + RtlMoveMemory temp_ip_address(1), hostip_addr, host.hLength + + + For i = 1 To host.hLength + ip_address = ip_address & temp_ip_address(i) & "." + Next + ip_address = Mid$(ip_address, 1, Len(ip_address) - 1) + + ' Return Both LAN and External IP Fix + ' Master Yoda 30-05-2000 + ' ########################################## + ' HERE'S THE PROBLEM!!! + 'TheIP = TheIP + ip_address + ' ########################################## + ' HERE'S THE FIX!!! + Internal = TheIP ' Send ONLY the External IP to the CurrentIP Function + External = ip_address ' Send the External IP to the function parameter External + TheIP = ip_address ' Send LAN IP to the function para Internal + + ' You don't really need to return parameters, + ' it just allows you to get both IPs :) + ' ########################################## + + ip_address = "" + host.hAddrList = host.hAddrList + LenB(host.hAddrList) + RtlMoveMemory hostip_addr, host.hAddrList, 4 + Loop While (hostip_addr <> 0) + + +If ReturnExternalIP = True Then + CurrentIP = External +Else + CurrentIP = Internal +End If +End Function + +Sub SocketsCleanup() + Dim lReturn As Long + lReturn = WSACleanup() + + + If lReturn <> 0 Then + MsgBox "Socket Error " & Trim$(Str$(lReturn)) & " occurred In Cleanup " + Exit Sub + End If +End Sub + +Sub OpenUrl(url As String) + + Shell ("Explorer " & url$), vbNormalNoFocus +End Sub