home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / lcocxweb / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-08-04  |  4.4 KB  |  144 lines

  1. VERSION 5.00
  2. Object = "{B190576C-254A-11D2-B61E-C80424DEEF17}#51.0#0"; "LCocx.ocx"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Tray Icon Demo"
  5.    ClientHeight    =   1800
  6.    ClientLeft      =   132
  7.    ClientTop       =   420
  8.    ClientWidth     =   5688
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   1800
  12.    ScaleWidth      =   5688
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin LCocx98.LCocx LCocx1 
  15.       Left            =   960
  16.       Top             =   1320
  17.       _ExtentX        =   656
  18.       _ExtentY        =   656
  19.    End
  20.    Begin VB.PictureBox Picture1 
  21.       AutoSize        =   -1  'True
  22.       BorderStyle     =   0  'None
  23.       Height          =   384
  24.       Left            =   360
  25.       Picture         =   "Form1.frx":0000
  26.       ScaleHeight     =   384
  27.       ScaleWidth      =   384
  28.       TabIndex        =   3
  29.       Top             =   1200
  30.       Width           =   384
  31.    End
  32.    Begin VB.CommandButton cmdremove 
  33.       Caption         =   "Remove Tray Icon"
  34.       Height          =   495
  35.       Left            =   3720
  36.       TabIndex        =   2
  37.       Top             =   360
  38.       Width           =   1632
  39.    End
  40.    Begin VB.CommandButton cmdedit 
  41.       Caption         =   "Edit Tray Icon"
  42.       Height          =   495
  43.       Left            =   2040
  44.       TabIndex        =   1
  45.       Top             =   360
  46.       Width           =   1632
  47.    End
  48.    Begin VB.CommandButton cmdshow 
  49.       Caption         =   "Show Tray Icon"
  50.       Height          =   495
  51.       Left            =   360
  52.       TabIndex        =   0
  53.       Top             =   360
  54.       Width           =   1632
  55.    End
  56.    Begin VB.Label lblspace 
  57.       AutoSize        =   -1  'True
  58.       Caption         =   "The Drive C: has MB Free"
  59.       Height          =   192
  60.       Left            =   2280
  61.       TabIndex        =   4
  62.       Top             =   1200
  63.       Width           =   1836
  64.    End
  65.    Begin VB.Menu mnufile 
  66.       Caption         =   "File"
  67.       Begin VB.Menu mnusystemtray 
  68.          Caption         =   "Tray Icon"
  69.          Visible         =   0   'False
  70.          Begin VB.Menu mnustatus 
  71.             Caption         =   "Status"
  72.          End
  73.          Begin VB.Menu mnucall 
  74.             Caption         =   "Call"
  75.          End
  76.          Begin VB.Menu mnuformat 
  77.             Caption         =   "Format"
  78.             Begin VB.Menu mnuwindow 
  79.                Caption         =   "Window"
  80.             End
  81.             Begin VB.Menu mnuline1 
  82.                Caption         =   "-"
  83.             End
  84.             Begin VB.Menu mnutools 
  85.                Caption         =   "Tools"
  86.             End
  87.             Begin VB.Menu mnuview 
  88.                Caption         =   "View"
  89.             End
  90.          End
  91.       End
  92.       Begin VB.Menu mnuexit 
  93.          Caption         =   "exit"
  94.       End
  95.    End
  96.    Begin VB.Menu mnusnsu 
  97.       Caption         =   "Help"
  98.       Begin VB.Menu mnuabout 
  99.          Caption         =   "About"
  100.       End
  101.    End
  102. Attribute VB_Name = "Form1"
  103. Attribute VB_GlobalNameSpace = False
  104. Attribute VB_Creatable = False
  105. Attribute VB_PredeclaredId = True
  106. Attribute VB_Exposed = False
  107. Private Sub cmdshow_Click()
  108. 'Show the Icon, if the icon is ommited, the form's icon will be used
  109. Call LCocx1.Traycon(Me, True, Picture1.Picture, "LCocx '98 Tray Icon (Double-Click to Show the Form)") 'Show Tray Icon
  110. Me.Hide
  111. End Sub
  112. Private Sub cmdedit_Click()
  113. s = InputBox("Enter String:")
  114. Call LCocx1.Traycon(Me, True, , s) 'Edit ToolTip
  115. End Sub
  116. Private Sub cmdremove_Click()
  117. Call LCocx1.Traycon(Me, False, , "") 'Remove from the Tray
  118. End Sub
  119. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  120.        
  121. Select Case LCocx1.TrayconClick(X, Y)
  122.         Case "LeftButtonDblClick" 'doubleclick
  123.         Me.Show
  124.         Case "LeftButtonUp" 'left click
  125.         'To do
  126.         Case "MiddleButtonUp" 'middle-button-click
  127.         'To do
  128.         Case "RightButtonUp" 'right-click
  129.         Me.PopupMenu mnusystemtray 'show menu
  130. End Select
  131. End Sub
  132. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  133. Call LCocx1.Traycon(Me, False, , "") 'Remove the icon on exit
  134. End Sub
  135. Sub mnuview_click()
  136. 'from the popup menu
  137. Me.Show
  138. End Sub
  139. Private Sub lblspace_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  140. 'display drive C's free space
  141. Free = LCocx1.DiskFree("C:")
  142. lblspace = "The Drive C: has " & Free & " MB Free"
  143. End Sub
  144.