-
Notifications
You must be signed in to change notification settings - Fork 12
/
StartOrb.frm
165 lines (120 loc) · 4.25 KB
/
StartOrb.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
VERSION 5.00
Begin VB.Form StartOrb
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 3030
ClientLeft = 0
ClientTop = 0
ClientWidth = 4560
LinkTopic = "Form1"
ScaleHeight = 202
ScaleMode = 3 'Pixel
ScaleWidth = 304
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "StartOrb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'--------------------------------------------------------------------------------
' Component : StartOrb
' Project : ViDock
'
' Description: The start menu launcher form
'
'--------------------------------------------------------------------------------
Option Explicit
Implements IHookSink
Private m_theStartButton As GDIPImage
Private m_graphics As GDIPGraphics
Private m_layeredWindowProperties As LayerdWindowHandles
Private m_buttonSlices As Collection
Private m_buttonState As ButtonState
Private m_mouseTracking As Boolean
Public Event onMove(ByRef newX As Long, ByRef newY As Long)
Private Sub Form_Click()
Me.Move 40, 40
End Sub
Private Sub Form_Load()
HookWindow Me.hWnd, Me
TrackMouseEvents Me.hWnd
Set m_theStartButton = New GDIPImage
Set m_graphics = New GDIPGraphics
Set m_buttonSlices = MenuListHelper.CreateButtonFromXML("start_button", m_theStartButton)
Dim thisCollection As Collection
Dim thisSlice As Slice
Set thisCollection = m_buttonSlices(1)
Set thisSlice = thisCollection(1)
Me.Width = m_theStartButton.Width * Screen.TwipsPerPixelX
Me.Height = thisSlice.Height * Screen.TwipsPerPixelY
'StayOnTop Me, True
InitializeGraphics
Paint
End Sub
Private Function InitializeGraphics()
Set m_layeredWindowProperties = MakeLayerdWindow(Me)
m_graphics.FromHDC m_layeredWindowProperties.theDC
End Function
Sub Paint()
m_graphics.Clear
MenuListHelper.DrawButton m_buttonSlices, m_buttonState, m_graphics, CreateRectL(54, Me.ScaleWidth, 0, 0)
m_layeredWindowProperties.Update Me.hWnd, m_layeredWindowProperties.theDC
'Me.Refresh
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
HandleMouseClicked
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m_mouseTracking = False Then
m_mouseTracking = TrackMouseEvents(Me.hWnd)
HandleMouseEnter
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
m_graphics.ReleaseHDC m_layeredWindowProperties.theDC
m_layeredWindowProperties.Release
UnhookWindow Me.hWnd
End Sub
'Private Function ISubclass_WindowProc(ByVal hWnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'If iMsg = WM_MOUSELEAVE Then
'm_mouseTracking = False
'HandleMouseLeave
'End If
'End Function
Private Function HandleMouseClicked()
m_buttonState = ButtonPressed
Paint
ShowStartMenu
End Function
Private Function HandleMouseLeave()
m_buttonState = ButtonUnpressed
Paint
End Function
Private Function HandleMouseEnter()
m_buttonState = ButtonOver
Paint
End Function
Private Function IHookSink_WindowProc(hWnd As Long, _
msg As Long, _
wp As Long, _
lp As Long) As Long
On Error GoTo Handler
If msg = WM_MOUSELEAVE Then
m_mouseTracking = False
HandleMouseLeave
ElseIf msg = WM_WINDOWPOSCHANGING Then
Dim thisWindowPosition As windowPos
CopyMemory thisWindowPosition, ByVal lp, LenB(thisWindowPosition)
RaiseEvent onMove(thisWindowPosition.X, thisWindowPosition.Y)
CopyMemory ByVal lp, thisWindowPosition, LenB(thisWindowPosition)
End If
Handler:
' Just allow default processing for everything else.
IHookSink_WindowProc = InvokeWindowProc(hWnd, msg, wp, lp)
End Function