-
Notifications
You must be signed in to change notification settings - Fork 2
/
MDialogs.bas
36 lines (30 loc) · 1005 Bytes
/
MDialogs.bas
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
Attribute VB_Name = "MDialogs"
Option Compare Database
Option Explicit
'The mcolDialogs collection holds references to dialog wrapper classes
'(usually CDlgxxx) that dialog forms can access.
Private mcolDialogs As New Collection
'A simple cyclic counter for generating dialog ids
Private mlNextDialogID As Long
Public Function RegDialogClass(ByRef poClassInst As Object) As String
Dim sKey As String
Const MAX_ID As Long = 65535
On Error GoTo RegDialogClass_Err
If mlNextDialogID < MAX_ID Then
mlNextDialogID = mlNextDialogID + 1&
Else
mlNextDialogID = 1
End If
sKey = CStr(mlNextDialogID)
mcolDialogs.Add Item:=poClassInst, Key:=sKey
RegDialogClass = sKey
RegDialogClass_Err:
End Function
Public Sub UnregDialogClass(ByVal psDialogID As String)
On Error Resume Next
mcolDialogs.Remove psDialogID
End Sub
Public Function GetDialogClass(ByVal psDialogID As String) As Object
On Error Resume Next
Set GetDialogClass = mcolDialogs(psDialogID)
End Function