home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / systrayc / csstray.exe / _SETUP.1 / frmEx2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-08-19  |  8.1 KB  |  216 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#3.1#0"; "CSSTRAY.OCX"
  4. Begin VB.Form frmEx2 
  5.    Caption         =   "SysTray Example Application #2"
  6.    ClientHeight    =   3255
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   5295
  10.    Icon            =   "frmEx2.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   3255
  14.    ScaleWidth      =   5295
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin csSysTrayCtl.csSysTray csSysTray1 
  18.       Left            =   4080
  19.       Top             =   2040
  20.       _ExtentX        =   2064
  21.       _ExtentY        =   1111
  22.       TrayIcon        =   "frmEx2.frx":0442
  23.       TrayTip         =   "Click this icon to zoom the window to/from the system tray!"
  24.    End
  25.    Begin VB.CommandButton cmdAnimate 
  26.       Caption         =   "Animate Icon"
  27.       Height          =   375
  28.       Left            =   2040
  29.       TabIndex        =   4
  30.       Top             =   2760
  31.       Width           =   1575
  32.    End
  33.    Begin VB.CommandButton cmdZoomToTray 
  34.       Caption         =   "&Zoom to Tray"
  35.       Height          =   375
  36.       Left            =   120
  37.       TabIndex        =   3
  38.       Top             =   2760
  39.       Width           =   1695
  40.    End
  41.    Begin VB.CommandButton cmdClose 
  42.       Cancel          =   -1  'True
  43.       Caption         =   "&Close"
  44.       Height          =   375
  45.       Left            =   4080
  46.       TabIndex        =   1
  47.       Top             =   2760
  48.       Width           =   1095
  49.    End
  50.    Begin ComctlLib.ImageList ImageList1 
  51.       Left            =   2520
  52.       Top             =   2040
  53.       _ExtentX        =   1005
  54.       _ExtentY        =   1005
  55.       BackColor       =   -2147483643
  56.       ImageWidth      =   16
  57.       ImageHeight     =   16
  58.       MaskColor       =   12632256
  59.       _Version        =   327682
  60.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  61.          NumListImages   =   7
  62.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  63.             Picture         =   "frmEx2.frx":0894
  64.             Key             =   ""
  65.          EndProperty
  66.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  67.             Picture         =   "frmEx2.frx":0BAE
  68.             Key             =   ""
  69.          EndProperty
  70.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  71.             Picture         =   "frmEx2.frx":0EC8
  72.             Key             =   ""
  73.          EndProperty
  74.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  75.             Picture         =   "frmEx2.frx":11E2
  76.             Key             =   ""
  77.          EndProperty
  78.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  79.             Picture         =   "frmEx2.frx":14FC
  80.             Key             =   ""
  81.          EndProperty
  82.          BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  83.             Picture         =   "frmEx2.frx":1816
  84.             Key             =   ""
  85.          EndProperty
  86.          BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  87.             Picture         =   "frmEx2.frx":1B30
  88.             Key             =   ""
  89.          EndProperty
  90.       EndProperty
  91.    End
  92.    Begin VB.Label Label1 
  93.       Caption         =   $"frmEx2.frx":1E4A
  94.       BeginProperty Font 
  95.          Name            =   "MS Sans Serif"
  96.          Size            =   8.25
  97.          Charset         =   0
  98.          Weight          =   700
  99.          Underline       =   0   'False
  100.          Italic          =   0   'False
  101.          Strikethrough   =   0   'False
  102.       EndProperty
  103.       Height          =   660
  104.       Left            =   120
  105.       TabIndex        =   5
  106.       Top             =   1440
  107.       Width           =   5055
  108.    End
  109.    Begin VB.Image Image1 
  110.       Height          =   480
  111.       Left            =   120
  112.       Picture         =   "frmEx2.frx":1EE6
  113.       Top             =   2160
  114.       Width           =   480
  115.    End
  116.    Begin VB.Label Label4 
  117.       Caption         =   $"frmEx2.frx":2328
  118.       BeginProperty Font 
  119.          Name            =   "MS Sans Serif"
  120.          Size            =   8.25
  121.          Charset         =   0
  122.          Weight          =   700
  123.          Underline       =   0   'False
  124.          Italic          =   0   'False
  125.          Strikethrough   =   0   'False
  126.       EndProperty
  127.       Height          =   780
  128.       Left            =   120
  129.       TabIndex        =   2
  130.       Top             =   600
  131.       Width           =   5055
  132.    End
  133.    Begin VB.Label Label3 
  134.       Caption         =   "This example application shows just how easy it is to use the SysTray control in your own application."
  135.       BeginProperty Font 
  136.          Name            =   "MS Sans Serif"
  137.          Size            =   8.25
  138.          Charset         =   0
  139.          Weight          =   700
  140.          Underline       =   0   'False
  141.          Italic          =   0   'False
  142.          Strikethrough   =   0   'False
  143.       EndProperty
  144.       Height          =   495
  145.       Left            =   120
  146.       TabIndex        =   0
  147.       Top             =   120
  148.       Width           =   5055
  149.    End
  150. Attribute VB_Name = "frmEx2"
  151. Attribute VB_GlobalNameSpace = False
  152. Attribute VB_Creatable = False
  153. Attribute VB_PredeclaredId = True
  154. Attribute VB_Exposed = False
  155. Option Explicit
  156. 'Example program for SysTray Control
  157. '(C) Copyright 1998 Charon Software, All Rights Reserved
  158. 'You may use or modify this code in any way you see fit.
  159. 'Charon Software takes no responsibility for what you may
  160. 'do with this or any modification of this code.
  161. 'Please note that the ShowInTaskbar property of this form
  162. 'is False; if it weren't, the window would zoom to the
  163. 'system tray and then the taskbar icon would disappear.
  164. 'It is designed to work either way.
  165. 'Also note that zooming the window to the system tray does
  166. 'not actually minimize the window: it just hides it.
  167. Private Sub cmdAnimate_Click()
  168.     'we change the caption on the command button to let the
  169.     'user simply click it to start (and then stop) the
  170.     'animation.  ImageList1 is the imagelist we have on our
  171.     'form, with the icons for the animation.  120 is the
  172.     'number of milliseconds to pause between each frame.
  173.     If cmdAnimate.Caption = "Animate Icon" Then
  174.         csSysTray1.StartAnimation ImageList1, 120
  175.         cmdAnimate.Caption = "Stop Animation"
  176.     Else
  177.         csSysTray1.StopAnimation
  178.         cmdAnimate.Caption = "Animate Icon"
  179.     End If
  180. End Sub
  181. Private Sub cmdClose_Click()
  182.     'pretty simple, just unload my form.  The system tray
  183.     'icons will go away automatically!
  184.     Unload Me
  185. End Sub
  186. Private Sub cmdZoomToTray_Click()
  187.     'zoom the window to the system tray.
  188.     csSysTray1.ZoomToTray Me.hWnd
  189. End Sub
  190. Private Sub csSysTray1_Click()
  191.     'when the user clicks on the system tray icon, we
  192.     'want to zoom the window to/from the system tray.
  193.     'note: when we zoom the window to/from the tray, we
  194.     'simply hide or show it, respectively.  We do not
  195.     'change its WindowState property nor unload it.
  196.     If Me.Visible = False Then
  197.         csSysTray1.ZoomFromTray Me.hWnd
  198.     Else
  199.         csSysTray1.ZoomToTray Me.hWnd
  200.     End If
  201. End Sub
  202. Private Sub Form_Load()
  203.     csSysTray1.AddMinimizeWatch Me.hWnd 'if a user presses "my" minimize button,
  204.                                         'I want to zoom to tray instead.
  205.                                         'Also, I could remove myself in my unload
  206.                                         'event, although it isn't necessary.
  207.                                         'Visual Basic and the SysTray control do it
  208.                                         'all automatically for you upon unload!
  209. End Sub
  210. Private Sub Form_Unload(Cancel As Integer)
  211. ' we could remove our "minimize watch" like the following, but we don't need to.
  212. '    csSysTray1.RemoveMinimizeWatch Me 'see Form_Load -- not necessary.
  213.     'for added effect, we'll zoom to the tray on exit
  214.     csSysTray1.ZoomToTray Me.hWnd
  215. End Sub
  216.