home *** CD-ROM | disk | FTP | other *** search
Visual Basic class definition | 2002-04-18 | 4.5 KB | 145 lines |
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "ascPropertyPicker"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- ' ------------------------------------------------------------------------
- ' Copyright ⌐ 1997 Microsoft Corporation. All rights reserved.
- '
- ' You have a royalty-free right to use, modify, reproduce and distribute
- ' the Sample Application Files (and/or any modified version) in any way
- ' you find useful, provided that you agree that Microsoft has no warranty,
- ' obligations or liability for any Sample Application Files.
- ' ------------------------------------------------------------------------
-
- 'Modifications:
- '24/08/99
- ' - (Richard Moss) Microsoft 'forgot' to add font support - I added it!
-
- Option Explicit
-
- Private Type GUID
- Data1 As Long
- Data2 As Integer
- Data3 As Integer
- Data4(7) As Byte
- End Type
-
- Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
- Private Declare Function OleCreatePropertyFrame Lib "oleaut32.dll" _
- (ByVal hWndOwner As Long, _
- ByVal X As Long, _
- ByVal Y As Long, _
- ByVal lpszCaption As Long, _
- ByVal cObjects As Long, _
- ByRef ppUnk As Long, _
- ByVal cPages As Long, _
- ByRef pPageClsID As GUID, _
- ByVal lcid As Long, _
- ByVal dwReserved As Long, _
- ByVal pvReserved As Long) As Long
-
- Public Enum PropertyPickerPages
- ppickColor = 1
- ppickPicture = 2
- ppickColorPicture = 3
- ppickPictureColor = 4
- ppickFont
- End Enum
-
- Public Sub ShowPicker(ByVal hWndOwner As Long, ByVal Caption As String, ByVal PropObject As Object, ByVal Pages As PropertyPickerPages)
- Dim rclsid(2) As GUID
- Dim lObjects(0) As Long
- Dim clsidColor As GUID
- Dim clsidPicture As GUID
- Dim clsidFont As GUID
- Dim lPageCount As Long
- Dim lRet As Long
-
- If Not PropObject Is Nothing Then
- lObjects(0) = ObjPtr(PropObject)
-
- 'Guid of CStockFontPage?
- '0x7ebdaae0?, 0x8120, 0x11cf, 0x89, 0x9f, 0x0, 0xaa, 0x0, 0x68, 0x8b, 0x10
- With clsidFont
- .Data1 = &H7EBDAAE0 '?
- .Data2 = &H8120
- .Data3 = &H11CF
- .Data4(0) = &H89
- .Data4(1) = &H9F
- .Data4(2) = &H0
- .Data4(3) = &HAA
- .Data4(4) = &H0
- .Data4(5) = &H68
- .Data4(6) = &H8B
- .Data4(7) = &H10
- End With
-
- 'Guid of CStockColorPage
- '0x7ebdaae1, 0x8120, 0x11cf, 0x89, 0x9f, 0x0, 0xaa, 0x0, 0x68, 0x8b, 0x10
- With clsidColor
- .Data1 = &H7EBDAAE1
- .Data2 = &H8120
- .Data3 = &H11CF
- .Data4(0) = &H89
- .Data4(1) = &H9F
- .Data4(2) = &H0
- .Data4(3) = &HAA
- .Data4(4) = &H0
- .Data4(5) = &H68
- .Data4(6) = &H8B
- .Data4(7) = &H10
- End With
-
- 'Guid of CStockPicturePage
- '0x7ebdaae2, 0x8120, 0x11cf, 0x89, 0x9f, 0x0, 0xaa, 0x0, 0x68, 0x8b, 0x10
- With clsidPicture
- .Data1 = &H7EBDAAE2
- .Data2 = &H8120
- .Data3 = &H11CF
- .Data4(0) = &H89
- .Data4(1) = &H9F
- .Data4(2) = &H0
- .Data4(3) = &HAA
- .Data4(4) = &H0
- .Data4(5) = &H68
- .Data4(6) = &H8B
- .Data4(7) = &H10
- End With
-
- Select Case Pages
- Case ppickColor
- rclsid(0) = clsidColor
- lPageCount = 1
- Case ppickColorPicture
- rclsid(0) = clsidColor
- rclsid(1) = clsidPicture
- lPageCount = 2
- Case ppickPicture
- rclsid(0) = clsidPicture
- lPageCount = 1
- Case ppickPictureColor
- rclsid(0) = clsidPicture
- rclsid(1) = clsidColor
- lPageCount = 2
- Case ppickFont
- rclsid(0) = clsidFont
- lPageCount = 1
- End Select
-
- lRet = OleCreatePropertyFrame(hWndOwner, 0, 0, StrPtr(Caption), 1, lObjects(0), lPageCount, rclsid(0), GetSystemDefaultLCID, 0&, 0&)
- If lRet <> 0 Then Err.Raise lRet
- End If
- End Sub
-
-
-
-