home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form APIMBtn
- BackColor = &H8000000F&
- BorderStyle = 0 'None
- ClientHeight = 588
- ClientLeft = 36
- ClientTop = 6480
- ClientWidth = 936
- ControlBox = 0 'False
- Height = 1008
- Left = -12
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 588
- ScaleWidth = 936
- Top = 6108
- Width = 1032
- Begin PictureBox tbBtnUp
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 264
- Left = 450
- Picture = APIMBTN.FRX:0000
- ScaleHeight = 264
- ScaleWidth = 288
- TabIndex = 0
- Top = 90
- Width = 288
- End
- Begin PictureBox tbBtnDn
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Enabled = 0 'False
- Height = 264
- Left = 90
- Picture = APIMBTN.FRX:0182
- ScaleHeight = 264
- ScaleWidth = 288
- TabIndex = 1
- Top = 90
- Width = 288
- End
- Option Explicit
- 'API declarations to enable adding a toolbar
- 'button to Visual BASIC's toolbar
- Declare Function SetParent% Lib "User" (ByVal hWndChild%, ByVal hWndParent%)
- Dim result As Integer 'return value from API calls
- Sub Form_Load ()
- Dim vbtoolbar As Integer 'handle to VB toolbar
- 'get handle of VB toolbar
- vbtoolbar = FindWindowByClass("wndclass_desked_gsk", 0&)
- 'if VB toolbar handle found - add button
- If vbtoolbar > 0 Then
- 'flag we have added button
- BtnLoaded = True
- 'hide buttons during transfer
- tbBtnUp.Visible = False
- tbBtnDn.Visible = False
- 'make button images children of VB toolbar
- result = SetParent(tbBtnUp.hWnd, vbtoolbar)
- result = SetParent(tbBtnDn.hWnd, vbtoolbar)
- 'position button images after existing VB buttons
- tbBtnUp.Move 5550, 25
- tbBtnDn.Move 5550, 25
- tbBtnUp.ZOrder
- 'reveal buttons
- tbBtnUp.Visible = True
- tbBtnDn.Visible = True
- End If
- End Sub
- Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
- If BtnLoaded Then
- 'recover button images from VB toolbar
- result = SetParent(tbBtnUp.hWnd, Me.hWnd)
- result = SetParent(tbBtnDn.hWnd, Me.hWnd)
- 'clear flag
- BtnLoaded = False
- End If
- End Sub
- Sub tbBtnUp_Click ()
- 'activate API Magic - restore if needed
- result = FindWindowByTitle(0&, "API Magic")
- If result = 0 Then Exit Sub
- result = ShowWindow(result, SW_SHOWNOACTIVATE)
- AppActivate "API Magic"
- DoEvents
- End Sub
- Sub tbBtnUp_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'on mousdown show button depressed
- tbBtnDn.ZOrder
- End Sub
- Sub tbBtnUp_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'show button depressed only while covered by mouse cursor
- If Button Then
- If X <= 0 Or X > tbBtnUp.Width Or Y < 0 Or Y > tbBtnUp.Height Then
- tbBtnUp.ZOrder
- Else
- tbBtnDn.ZOrder
- End If
- End If
- End Sub
- Sub tbBtnUp_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'on mouseup show button released
- tbBtnUp.ZOrder
- End Sub
-