home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / isconn_1 / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-31  |  6.6 KB  |  211 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
  4. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  5. Begin VB.Form clipa 
  6.    BorderStyle     =   5  'Sizable ToolWindow
  7.    Caption         =   "Mostafa Live pictures"
  8.    ClientHeight    =   5985
  9.    ClientLeft      =   60
  10.    ClientTop       =   300
  11.    ClientWidth     =   6045
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   5985
  17.    ScaleWidth      =   6045
  18.    ShowInTaskbar   =   0   'False
  19.    Begin MSComctlLib.ProgressBar ProgressBar1 
  20.       Align           =   2  'Align Bottom
  21.       Height          =   150
  22.       Left            =   0
  23.       TabIndex        =   3
  24.       Top             =   5835
  25.       Width           =   6045
  26.       _ExtentX        =   10663
  27.       _ExtentY        =   265
  28.       _Version        =   393216
  29.       Appearance      =   1
  30.       Min             =   7
  31.       Max             =   8
  32.    End
  33.    Begin VB.Timer Timer1 
  34.       Interval        =   1
  35.       Left            =   960
  36.       Top             =   4560
  37.    End
  38.    Begin VB.PictureBox Picture1 
  39.       Align           =   1  'Align Top
  40.       Appearance      =   0  'Flat
  41.       BackColor       =   &H80000005&
  42.       ForeColor       =   &H80000008&
  43.       Height          =   1035
  44.       Left            =   0
  45.       Picture         =   "main.frx":0000
  46.       ScaleHeight     =   1005
  47.       ScaleWidth      =   6015
  48.       TabIndex        =   1
  49.       Top             =   0
  50.       Width           =   6045
  51.    End
  52.    Begin MSComctlLib.ListView ListView1 
  53.       Height          =   3015
  54.       Left            =   0
  55.       TabIndex        =   0
  56.       Top             =   1080
  57.       Width           =   3495
  58.       _ExtentX        =   6165
  59.       _ExtentY        =   5318
  60.       LabelWrap       =   -1  'True
  61.       HideSelection   =   -1  'True
  62.       FlatScrollBar   =   -1  'True
  63.       HotTracking     =   -1  'True
  64.       HoverSelection  =   -1  'True
  65.       _Version        =   393217
  66.       Icons           =   "ImageList1"
  67.       SmallIcons      =   "ImageList1"
  68.       ColHdrIcons     =   "ImageList1"
  69.       ForeColor       =   -2147483640
  70.       BackColor       =   -2147483643
  71.       BorderStyle     =   1
  72.       Appearance      =   1
  73.       NumItems        =   0
  74.    End
  75.    Begin MSComctlLib.ImageList ImageList1 
  76.       Left            =   0
  77.       Top             =   3960
  78.       _ExtentX        =   1005
  79.       _ExtentY        =   1005
  80.       BackColor       =   -2147483643
  81.       ImageWidth      =   48
  82.       ImageHeight     =   48
  83.       MaskColor       =   12632256
  84.       _Version        =   393216
  85.    End
  86.    Begin InetCtlsObjects.Inet Inet1 
  87.       Left            =   0
  88.       Top             =   3720
  89.       _ExtentX        =   1005
  90.       _ExtentY        =   1005
  91.       _Version        =   393216
  92.       Protocol        =   4
  93.       RemoteHost      =   "www.microsoft.com"
  94.       URL             =   "http://www.microsoft.com"
  95.       RequestTimeout  =   420
  96.    End
  97.    Begin RichTextLib.RichTextBox RichTextBox1 
  98.       Height          =   2175
  99.       Left            =   720
  100.       TabIndex        =   2
  101.       Top             =   1920
  102.       Visible         =   0   'False
  103.       Width           =   5535
  104.       _ExtentX        =   9763
  105.       _ExtentY        =   3836
  106.       _Version        =   393217
  107.       TextRTF         =   $"main.frx":19A6A
  108.    End
  109. Attribute VB_Name = "clipa"
  110. Attribute VB_GlobalNameSpace = False
  111. Attribute VB_Creatable = False
  112. Attribute VB_PredeclaredId = True
  113. Attribute VB_Exposed = False
  114. Dim xx As Integer
  115. Function IsConnected() As Boolean
  116. On Error Resume Next
  117.     Dim TRasCon(255) As RASCONN95
  118.     Dim lg As Long
  119.     Dim lpcon As Long
  120.     Dim RetVal As Long
  121.     Dim Tstatus As RASCONNSTATUS95
  122.     TRasCon(0).dwSize = 412
  123.     lg = 256 * TRasCon(0).dwSize
  124.     RetVal = RasEnumConnections(TRasCon(0), lg, lpcon)
  125.     If RetVal <> 0 Then
  126.         MsgBox "ERROR"
  127.         Exit Function
  128.     End If
  129.     Tstatus.dwSize = 160
  130.     RetVal = RasGetConnectStatus(TRasCon(0).hRasCon, Tstatus)
  131.     If Tstatus.RasConnState = &H2000 Then
  132.         IsConnected = True
  133.     Else
  134.         IsConnected = False
  135.     End If
  136. End Function
  137. Sub getpicture()
  138. Dim b() As Byte
  139. Dim xx
  140. Dim strURL As String
  141. Dim a As String
  142. Screen.MousePointer = 11
  143. RichTextBox1.Text = Inet1.OpenURL("http://www.geocities.com/ResearchTriangle/Campus/4598/clip1art.txt")
  144. RichTextBox1.SaveFile App.Path & "\clip2.txt", 0
  145. RichTextBox1.LoadFile App.Path & "\clip2.txt", 0
  146. RichTextBox1.SaveFile App.Path & "\clip1.txt", 1
  147. Dim freef As Integer
  148. Dim nooo As Integer
  149. freef = FreeFile
  150. Open App.Path & "\clip1.txt" For Input As #freef
  151. Input #freef, a, strURL
  152. b() = Inet1.OpenURL(strURL, icByteArray)
  153. nooo = FreeFile
  154. Open App.Path & "\temp.tmp" For Binary Access Write As #nooo
  155. Put #nooo, , b()
  156. Close #nooo
  157. xx = xx + 1
  158. ImageList1.ListImages.Add xx, , LoadPicture(App.Path & "\temp.tmp")
  159. ListView1.ListItems.Add xx, , , xx, xx
  160. Loop Until EOF(freef)
  161. Close #freef
  162. Screen.MousePointer = 0
  163. End Sub
  164. Private Sub Command1_Click()
  165. End Sub
  166. Private Sub Command2_Click()
  167. End Sub
  168. Private Sub Form_Resize()
  169. On Error Resume Next
  170. ListView1.Width = Me.ScaleWidth
  171. ListView1.Height = Me.Height - ListView1.Top - ProgressBar1.Height - 10
  172. End Sub
  173. Private Sub Inet1_StateChanged(ByVal State As Integer)
  174. On Error Resume Next
  175. If State >= 7 Then
  176. ProgressBar1.Value = State
  177. End If
  178. End Sub
  179. Private Sub ListView1_Click()
  180. On Error GoTo er
  181. imagemax = imagemax + 1
  182. Load Form1.Image1(imagemax)
  183. SavePicture ImageList1.ListImages.Item(ListView1.SelectedItem.Index).Picture, App.Path & "\imagelive" & ListView1.SelectedItem.Index & imagemax & ".bmp"
  184. Form1.Image1(imagemax).Picture = LoadPicture(App.Path & "\imagelive" & ListView1.SelectedItem.Index & imagemax & ".bmp")
  185. Form1.Image1(imagemax).ToolTipText = App.Path & "\imagelive" & ListView1.SelectedItem.Index & imagemax & ".bmp"
  186. Form1.Image1(imagemax).Visible = True
  187. Form1.Image1(imagemax).Left = 0
  188. Form1.Image1(imagemax).Top = 0
  189. Form1.Image1(imagemax).Stretch = True
  190. Form1.Image1(imagemax).ZOrder 0
  191. Dim str1 As String
  192. Dim str2 As String
  193. indexctrl = imagemax
  194. changes = True
  195. Exit Sub
  196. If Err.Number <> 32755 Then
  197. MsgBox Err.Description
  198. End If
  199. End Sub
  200. Private Sub Timer1_Timer()
  201. On Error Resume Next
  202. If IsConnected = False Then
  203. MsgBox "You must connect to internet before open Mostafa live pictures"
  204. Unload Me
  205. Exit Sub
  206. getpicture
  207. Form_Resize
  208. End If
  209. Timer1.Enabled = False
  210. End Sub
  211.