forked from lee-soft/ViPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmZOrderContainer.frm
108 lines (85 loc) · 2.34 KB
/
frmZOrderContainer.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
VERSION 5.00
Begin VB.Form ZOrderContainer
Caption = "Form1"
ClientHeight = 4800
ClientLeft = 10635
ClientTop = 6000
ClientWidth = 5850
LinkTopic = "Form1"
ScaleHeight = 4800
ScaleWidth = 5850
Begin VB.Timer timClose
Enabled = 0 'False
Interval = 1
Left = 960
Top = 1800
End
End
Attribute VB_Name = "ZOrderContainer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
'
'
Private m_child As Form
Private m_children As Collection
Implements IHookSink
Sub CloseForm()
timClose.Enabled = True
End Sub
Sub RemoveChild(ByRef theForm As Form)
Dim szKey As String
szKey = "hwnd_" & theForm.hWnd
If ExistInCol(m_children, szKey) Then m_children.Remove szKey
End Sub
Sub AddChild(ByRef theForm As Form)
Dim szKey As String
szKey = "hwnd_" & theForm.hWnd
If Not ExistInCol(m_children, szKey) Then
m_children.Add theForm, szKey
If theForm.WindowState <> vbNormal Then
theForm.WindowState = vbNormal
End If
theForm.Hide
theForm.Show vbModeless, Me
End If
End Sub
Private Sub Form_Load()
Set m_children = New Collection
Dim hprog As Long
hprog = FindWindowEx(hwndDesktopChild, 0, "SysListView32", "FolderView")
SetParent Me.hWnd, hprog
HookWindow Me.hWnd, Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnhookWindow Me.hWnd
End Sub
Private Sub FrontForms()
Dim thisForm As Form
Dim thisViWindow As ViPickWindow
For Each thisForm In m_children
If thisForm.Name = "ViPickWindow" Then
Set thisViWindow = thisForm
thisViWindow.zOrderWindow
End If
Next
End Sub
Private Function IHookSink_WindowProc(hWnd As Long, msg As Long, wParam As Long, lParam As Long) As Long
Dim pos As WINDOWPOS
Dim bEat As Boolean
If msg = WM_SHOWWINDOW Then
If Not m_child Is Nothing Then
FrontForms
End If
End If
If Not bEat Then
' Just allow default processing for everything else.
IHookSink_WindowProc = _
InvokeWindowProc(hWnd, msg, wParam, lParam)
End If
End Function
Private Sub timClose_Timer()
Unload Me
End Sub