home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD98529122000.psc / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-09-13  |  9.4 KB  |  291 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. Begin VB.Form Form1 
  5.    BackColor       =   &H80000009&
  6.    BorderStyle     =   4  'Fixed ToolWindow
  7.    Caption         =   "msn dictionary"
  8.    ClientHeight    =   6015
  9.    ClientLeft      =   45
  10.    ClientTop       =   285
  11.    ClientWidth     =   5805
  12.    Icon            =   "Form1.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   6015
  16.    ScaleWidth      =   5805
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   3  'Windows Default
  19.    Begin InetCtlsObjects.Inet Inet1 
  20.       Left            =   2640
  21.       Top             =   2760
  22.       _ExtentX        =   1005
  23.       _ExtentY        =   1005
  24.       _Version        =   393216
  25.    End
  26.    Begin MSComctlLib.StatusBar StatusBar1 
  27.       Align           =   2  'Align Bottom
  28.       Height          =   255
  29.       Left            =   0
  30.       TabIndex        =   2
  31.       Top             =   5760
  32.       Width           =   5805
  33.       _ExtentX        =   10239
  34.       _ExtentY        =   450
  35.       _Version        =   393216
  36.       BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
  37.          NumPanels       =   2
  38.          BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  39.             Style           =   6
  40.             Alignment       =   1
  41.             TextSave        =   "9/12/2000"
  42.          EndProperty
  43.          BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
  44.             Alignment       =   1
  45.             AutoSize        =   1
  46.             Object.Width           =   7620
  47.             Text            =   "welcome to the msn dictionary"
  48.             TextSave        =   "welcome to the msn dictionary"
  49.          EndProperty
  50.       EndProperty
  51.    End
  52.    Begin VB.CommandButton Command1 
  53.       Caption         =   "loop up"
  54.       Height          =   255
  55.       Left            =   4680
  56.       TabIndex        =   1
  57.       Top             =   240
  58.       Width           =   975
  59.    End
  60.    Begin VB.TextBox Text1 
  61.       Alignment       =   2  'Center
  62.       Appearance      =   0  'Flat
  63.       Height          =   285
  64.       Left            =   2040
  65.       TabIndex        =   0
  66.       Top             =   240
  67.       Width           =   2535
  68.    End
  69.    Begin VB.Label lblseconddef 
  70.       BackStyle       =   0  'Transparent
  71.       ForeColor       =   &H8000000E&
  72.       Height          =   1695
  73.       Left            =   720
  74.       TabIndex        =   6
  75.       Top             =   3240
  76.       Width           =   4335
  77.    End
  78.    Begin VB.Label lblsecond 
  79.       BackStyle       =   0  'Transparent
  80.       Caption         =   "second definition:"
  81.       BeginProperty Font 
  82.          Name            =   "MS Sans Serif"
  83.          Size            =   8.25
  84.          Charset         =   0
  85.          Weight          =   700
  86.          Underline       =   0   'False
  87.          Italic          =   0   'False
  88.          Strikethrough   =   0   'False
  89.       EndProperty
  90.       ForeColor       =   &H8000000E&
  91.       Height          =   255
  92.       Left            =   240
  93.       TabIndex        =   5
  94.       Top             =   3000
  95.       Width           =   4815
  96.    End
  97.    Begin VB.Label lblfirstdef 
  98.       BackStyle       =   0  'Transparent
  99.       ForeColor       =   &H8000000E&
  100.       Height          =   1695
  101.       Left            =   720
  102.       TabIndex        =   4
  103.       Top             =   1320
  104.       Width           =   4335
  105.    End
  106.    Begin VB.Label lblfirst 
  107.       BackStyle       =   0  'Transparent
  108.       Caption         =   "first definition:"
  109.       BeginProperty Font 
  110.          Name            =   "MS Sans Serif"
  111.          Size            =   8.25
  112.          Charset         =   0
  113.          Weight          =   700
  114.          Underline       =   0   'False
  115.          Italic          =   0   'False
  116.          Strikethrough   =   0   'False
  117.       EndProperty
  118.       ForeColor       =   &H8000000E&
  119.       Height          =   255
  120.       Left            =   240
  121.       TabIndex        =   3
  122.       Top             =   1080
  123.       Width           =   4815
  124.    End
  125.    Begin VB.Image Image2 
  126.       Height          =   585
  127.       Left            =   120
  128.       Picture         =   "Form1.frx":0ECA
  129.       Top             =   5040
  130.       Width           =   2355
  131.    End
  132.    Begin VB.Image Image3 
  133.       Height          =   4965
  134.       Left            =   0
  135.       Picture         =   "Form1.frx":1D44
  136.       Stretch         =   -1  'True
  137.       Top             =   840
  138.       Width           =   5820
  139.    End
  140.    Begin VB.Line Line1 
  141.       X1              =   1800
  142.       X2              =   1800
  143.       Y1              =   0
  144.       Y2              =   720
  145.    End
  146.    Begin VB.Image Image1 
  147.       Height          =   660
  148.       Left            =   0
  149.       Picture         =   "Form1.frx":1FF3
  150.       Top             =   0
  151.       Width           =   1725
  152.    End
  153.    Begin VB.Menu mnu_1 
  154.       Caption         =   "mnu_1"
  155.       Visible         =   0   'False
  156.       Begin VB.Menu show 
  157.          Caption         =   "show dictionary"
  158.       End
  159.       Begin VB.Menu break 
  160.          Caption         =   "-"
  161.       End
  162.       Begin VB.Menu end 
  163.          Caption         =   "exit"
  164.       End
  165.    End
  166. Attribute VB_Name = "Form1"
  167. Attribute VB_GlobalNameSpace = False
  168. Attribute VB_Creatable = False
  169. Attribute VB_PredeclaredId = True
  170. Attribute VB_Exposed = False
  171. Sub DefineWord(word As String)
  172. On Error GoTo err:
  173. Text1.Text = Trim(Text1.Text)
  174. StatusBar1.Panels(2).Text = "contacting msn dictionary"
  175. Inet1.URL = "http://dictionary.msn.com/find/entry.asp?search=" & Text1.Text
  176. def = Inet1.OpenURL(Inet1.URL)
  177. StatusBar1.Panels(2).Text = "opening dictionary page"
  178. If InStr(1, def, "No matches found for") Then GoTo nomatch:
  179. beginspot = InStr(1, def, "<div class='dictionary'>") + 24
  180. EndSpot = InStr(beginspot, def, "Encarta
  181.  World English Dictionary")
  182. spot1 = beginspot
  183. spot2 = beginspot + 2
  184. StatusBar1.Panels(2).Text = "getting definitions"
  185. ' Get 2 Defs
  186.    spot1 = InStr(spot1, def, "-1")
  187.    spot1 = InStr(spot1, def, "<b>") + 3
  188.    spot2 = InStr(spot1, def, "</b>")
  189.    lblfirst.Caption = Mid$(def, spot1, spot2 - spot1)
  190.    If InStr(1, lblfirst.Caption, "<") Then GoTo nomatch:
  191.    spot1 = spot2 + 1
  192.    spot1 = InStr(spot1, def, "</font>") + 7
  193.    spot2 = InStr(spot1, def, "<br />")
  194.    If InStr(spot1, def, "<img") < InStr(spot1, def, "<br />") Then
  195.         spot2 = InStr(spot1, def, "<img")
  196.    End If
  197.    If InStr(spot1, def, "<i>") < spot2 Then
  198.         spot2 = InStr(spot1, def, "<i>") - 1
  199.     End If
  200.    lblfirstdef.Caption = Mid$(def, spot1, spot2 - spot1)
  201. ' Second Def
  202.    spot1 = InStr(spot1, def, "-1")
  203.    spot1 = InStr(spot1, def, "<b>") + 3
  204.    spot2 = InStr(spot1, def, "</b>")
  205.    lblsecond.Caption = Mid$(def, spot1, spot2 - spot1)
  206.    spot1 = spot2 + 1
  207.    spot1 = InStr(spot1, def, "</font>") + 7
  208.    spot2 = InStr(spot1, def, "<br />")
  209.    If InStr(spot1, def, "<img") < InStr(spot1, def, "<br />") Then
  210.         spot2 = InStr(spot1, def, "<img")
  211.    End If
  212.       If InStr(spot1, def, "<i>") < spot2 Then
  213.         spot2 = InStr(spot1, def, "<i>") - 1
  214.     End If
  215.    lblseconddef.Caption = Mid$(def, spot1, spot2 - spot1)
  216.     StatusBar1.Panels(2).Text = "welcome to the dictionary"
  217.     For a = 1395 To 6375
  218.         Form1.Height = a
  219.     Next a
  220.     Exit Sub
  221. nomatch:
  222.     lblfirst.Caption = "first definition"
  223.     lblfirstdef.Caption = "No matches found for your word or word is sensored"
  224.         StatusBar1.Panels(2).Text = "welcome to the msn dictionary"
  225.     For a = 1395 To 6375
  226.         Form1.Height = a
  227.     Next a
  228.     Exit Sub
  229. End Sub
  230. Private Sub Command1_Click()
  231. Me.Height = 1395
  232. If Trim(Text1.Text) = "" Then Exit Sub
  233. lblfirst.Caption = "first definition"
  234. lblfirstdef.Caption = ""
  235. lblsecond.Caption = "second definition"
  236. lblseconddef.Caption = ""
  237. DefineWord Text1.Text
  238. End Sub
  239. Private Sub end_Click()
  240. End Sub
  241. Private Sub Form_Load()
  242. lblfirst.Caption = "first definition"
  243. lblfirstdef.Caption = ""
  244. lblsecond.Caption = "second definition"
  245. lblseconddef.Caption = ""
  246. Me.Height = 1395
  247.     Me.show
  248.     Me.Refresh
  249.     With nid
  250.         .cbSize = Len(nid)
  251.         .hwnd = Me.hwnd
  252.         .uId = vbNull
  253.         .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
  254.         .uCallBackMessage = WM_MOUSEMOVE
  255.         .hIcon = Me.Icon
  256.         .szTip = " Click Right Mouse Button " & vbNullChar
  257.     End With
  258.     Shell_NotifyIcon NIM_ADD, nid
  259. End Sub
  260. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  261.     Dim Result As Long
  262.     Dim msg As Long
  263.     If Me.ScaleMode = vbPixels Then
  264.         msg = X
  265.     Else
  266.         msg = X / Screen.TwipsPerPixelX
  267.     End If
  268.     Select Case msg
  269.         Case WM_LBUTTONUP '514 restore form window
  270.         Me.WindowState = vbNormal
  271.         Result = SetForegroundWindow(Me.hwnd)
  272.         Me.show
  273.         Case WM_LBUTTONDBLCLK '515 restore form window
  274.         Me.WindowState = vbNormal
  275.         Result = SetForegroundWindow(Me.hwnd)
  276.         Me.show
  277.         Case WM_RBUTTONUP '517 display popup menu
  278.         Result = SetForegroundWindow(Me.hwnd)
  279.         Me.PopupMenu Me.mnu_1
  280.     End Select
  281. End Sub
  282. Private Sub Form_Resize()
  283.     If Me.WindowState = vbMinimized Then Me.Hide
  284. End Sub
  285. Private Sub Form_Unload(Cancel As Integer)
  286.     Shell_NotifyIcon NIM_DELETE, nid
  287. End Sub
  288. Private Sub show_Click()
  289. Me.SetFocus
  290. End Sub
  291.