home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmMain
- BackColor = &H00C0C0C0&
- Caption = "Using Other OLE Objects Demonstration"
- ClientHeight = 3990
- ClientLeft = 1020
- ClientTop = 1755
- ClientWidth = 5370
- Height = 4680
- Icon = "frmmain.frx":0000
- Left = 960
- LinkTopic = "Form1"
- ScaleHeight = 3990
- ScaleWidth = 5370
- Top = 1125
- Width = 5490
- Begin VB.PictureBox Toolbar
- Align = 1 'Align Top
- Appearance = 0 'Flat
- BackColor = &H00C0C0C0&
- ForeColor = &H80000008&
- Height = 465
- Left = 0
- Negotiate = -1 'True
- ScaleHeight = 435
- ScaleWidth = 5340
- TabIndex = 2
- Top = 0
- Width = 5370
- Begin VB.Image imgTools
- Height = 330
- Index = 11
- Left = 4500
- Picture = "frmmain.frx":030A
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 10
- Left = 1980
- Picture = "frmmain.frx":0494
- Stretch = -1 'True
- Tag = "Terminates this application"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 9
- Left = 4140
- Picture = "frmmain.frx":061E
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 8
- Left = 1530
- Picture = "frmmain.frx":07A8
- Stretch = -1 'True
- Tag = "Opens a Video for Windows 1.1 OLE Example"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 7
- Left = 3780
- Picture = "frmmain.frx":0932
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 6
- Left = 1170
- Picture = "frmmain.frx":0ABC
- Stretch = -1 'True
- Tag = "Opens a Sound Recorder Example"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 5
- Left = 3420
- Picture = "frmmain.frx":0C46
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 4
- Left = 810
- Picture = "frmmain.frx":0DD0
- Stretch = -1 'True
- Tag = "Opens a Project 4.0 Example"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 3
- Left = 3060
- Picture = "frmmain.frx":0F5A
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 2
- Left = 450
- Picture = "frmmain.frx":10E4
- Stretch = -1 'True
- Tag = "Opens a PowerPoint 4.0 Example"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 1
- Left = 2700
- Picture = "frmmain.frx":126E
- Stretch = -1 'True
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- Begin VB.Image imgTools
- Height = 330
- Index = 0
- Left = 90
- Picture = "frmmain.frx":13F8
- Stretch = -1 'True
- Tag = "Opens a Paintbrush Example"
- Top = 45
- Width = 360
- End
- Begin VB.Image imgHold
- Height = 315
- Left = 5040
- Top = 45
- Visible = 0 'False
- Width = 360
- End
- End
- Begin VB.PictureBox StatusBar
- Align = 2 'Align Bottom
- Appearance = 0 'Flat
- BackColor = &H00C0C0C0&
- ForeColor = &H80000008&
- Height = 420
- Left = 0
- ScaleHeight = 390
- ScaleWidth = 5340
- TabIndex = 0
- Top = 3570
- Width = 5370
- Begin VB.Label lblStatus
- BackStyle = 0 'Transparent
- Caption = "Ready"
- Height = 240
- Left = 90
- TabIndex = 1
- Top = 90
- Width = 5505
- End
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileItems
- Caption = "E&xit"
- Index = 1
- End
- End
- Begin VB.Menu mnuView
- Caption = "&View"
- Begin VB.Menu mnuViewItems
- Caption = "&Paintbrush 3.1"
- Index = 1
- Shortcut = ^P
- End
- Begin VB.Menu mnuViewItems
- Caption = "Po&werPoint 4.0"
- Index = 2
- Shortcut = ^W
- End
- Begin VB.Menu mnuViewItems
- Caption = "Pro&ject 4.0"
- Index = 3
- Shortcut = ^J
- End
- Begin VB.Menu mnuViewItems
- Caption = "&Sound Recorder 3.1"
- Index = 4
- Shortcut = ^S
- End
- Begin VB.Menu mnuViewItems
- Caption = "&Video for Windows 1.1"
- Index = 5
- Shortcut = ^V
- End
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- '*********************************************************************
- ' FRMMAIN.FRM: This is the main interface for the application that
- ' "looks" like a MDI Parent, but it's actually a normal
- ' VB form.
- '*********************************************************************
- Option Explicit
- '*********************************************************************
- ' Maximize the form to fit the screen.
- '*********************************************************************
- Private Sub Form_Load()
- BackColor = vb3DFace
- Toolbar.BackColor = vb3DFace
- StatusBar.BackColor = vb3DFace
- WindowState = 2
- End Sub
- '*********************************************************************
- ' Reset the status bar to Ready.
- '*********************************************************************
- Private Sub Form_MouseMove(Button%, Shift%, x!, y!)
- UpdateStatus lblStatus
- End Sub
- '*********************************************************************
- ' Prevent the user from resizing the form.
- '*********************************************************************
- Private Sub Form_Resize()
- If WindowState = 0 Then Form_Load
- End Sub
- '*********************************************************************
- ' Unload Everything.
- '*********************************************************************
- Private Sub Form_Unload(Cancel As Integer)
- End
- End Sub
- '*********************************************************************
- ' Handle File Exit.
- '*********************************************************************
- Private Sub mnuFileItems_Click(Index As Integer)
- Unload Me
- End Sub
- '*********************************************************************
- ' Handle View Submenu.
- '*********************************************************************
- Private Sub mnuViewItems_Click(Index As Integer)
- With frmObject
- Select Case Index
- Case 1
- .Display .olePaint
- Case 2
- .Display .olePowerPoint
- Case 3 '
- .Display .oleProject
- Case 4
- .Display .oleSound
- Case 5
- On Error Resume Next
- .oleVideo.CreateEmbed App.Path & "\sample.avi"
- If Err Then
- MsgBox "Err = " & Format(Err) & ": " & Error, vbCritical
- Unload frmObject
- End If
- .Display .oleVideo
- End Select
- End With
- End Sub
- '*********************************************************************
- ' Saves the button image in imgHold, and inserts the down picture.
- '*********************************************************************
- Private Sub imgTools_MouseDown(Index%, Button%, Shift%, x!, y!)
- imgHold.Picture = imgTools(Index).Picture
- imgTools(Index).Picture = imgTools(Index + 1).Picture
- End Sub
- '*********************************************************************
- ' Updates the status bar.
- '*********************************************************************
- Private Sub imgTools_MouseMove(Index%, Button%, Shift%, x!, y!)
- UpdateStatus lblStatus, imgTools(Index).Tag
- End Sub
- '*********************************************************************
- ' Restores the graphic, and processes toolbar clicks.
- '*********************************************************************
- Private Sub imgTools_MouseUp(Index%, Button%, Shift%, x!, y!)
- '*****************************************************************
- ' Restore the toolbar picture.
- '*****************************************************************
- imgTools(Index).Picture = imgHold.Picture
- '*****************************************************************
- ' Execute the appropriate toolbar action.
- '*****************************************************************
- Select Case Index
- Case 0 'Paintbrush
- mnuViewItems_Click 1
- Case 2 'PowerPoint
- mnuViewItems_Click 2
- Case 4 'Project
- mnuViewItems_Click 3
- Case 6 'Sound
- mnuViewItems_Click 4
- Case 8 'Video for Windows
- mnuViewItems_Click 5
- Case 10 'Exit
- Unload Me
- End Select
- End Sub
- '*********************************************************************
- ' Adds a 3D effect to a picture box.
- '*********************************************************************
- Private Sub HighlightBar(Bar As PictureBox)
- Bar.Line (0, 5)-(Bar.ScaleWidth, 5), vb3DHighlight
- Bar.Line (0, Bar.ScaleHeight - 15)-(Bar.ScaleWidth, _
- Bar.ScaleHeight - 15), vb3DShadow
- End Sub
- '*********************************************************************
- ' Adds a 3D border around a control.
- '*********************************************************************
- Private Sub Highlight(Object As Control)
- Const HORIZONTAL_OFFSET = 50
- Const VERTICAL_OFFSET = 70
- '*****************************************************************
- ' Top
- '*****************************************************************
- StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
- Object.Top - HORIZONTAL_OFFSET)- _
- (Object.Width, _
- Object.Top - HORIZONTAL_OFFSET), _
- vb3DShadow
- '*****************************************************************
- ' Left
- '*****************************************************************
- StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
- Object.Top - HORIZONTAL_OFFSET)- _
- (Object.Left - HORIZONTAL_OFFSET, _
- Object.Height + VERTICAL_OFFSET), _
- vb3DShadow
- '*****************************************************************
- ' Bottom
- '*****************************************************************
- StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
- Object.Height + VERTICAL_OFFSET)- _
- (Object.Width, _
- Object.Height + VERTICAL_OFFSET), _
- vb3DHighlight
- '*****************************************************************
- ' Right
- '*****************************************************************
- StatusBar.Line (Object.Width, _
- Object.Top - HORIZONTAL_OFFSET)- _
- (Object.Width, _
- Object.Height + VERTICAL_OFFSET + 15), _
- vb3DHighlight
- End Sub
- '*********************************************************************
- ' Generic update status bar routine.
- '*********************************************************************
- Public Sub UpdateStatus(StatusBar As Label, Optional StatusText)
- StatusBar = IIf(IsMissing(StatusText), "Ready", StatusText)
- End Sub
- '*********************************************************************
- ' Adds a 3D appearance to the status bar.
- '*********************************************************************
- Private Sub StatusBar_Paint()
- HighlightBar StatusBar
- Highlight lblStatus
- End Sub
- '*********************************************************************
- ' Reset the StatusBar to Ready.
- '*********************************************************************
- Private Sub Toolbar_MouseMove(Button%, Shift%, x As Single, y As Single)
- UpdateStatus lblStatus
- End Sub
- '*********************************************************************
- ' Adds a 3D appearance to the toolbar.
- '*********************************************************************
- Private Sub Toolbar_Paint()
- HighlightBar Toolbar
- End Sub
-