You can do this with the
ISpecifyPropertyPages COM interface and the
OleCreatePropertyFrame function. The hard part is getting definitions of the interface, interface methods, supporting data types, etc. that you can use from VB. Here's one way to do it:
- Download tl_ole.zip, which is a type library that contains definitions for several OLE interfaces, structures, and functions.
- Create a new VB project and add a reference to the type library.
- Add a Measurem
ent Studio ActiveX control (i.e., CWGraph) to the form and add a button to the form.
- Add the following code to your VB project:
Private Sub Command1_Click()
ShowPropertyPages CWGraph1.Object, "Graph", Me.hWnd
End Sub
Public Sub ShowPropertyPages(comObject As Object, name As String, hWnd As Long)
Dim specifyPages As ISpecifyPropertyPages
Set specifyPages = comObject
If Not specifyPages Is Nothing Then
Dim pages As CAUUID
specifyPages.GetPages pages
OleCreatePropertyFrame hWnd, 0, 0, name, 1, comObject, pages.cElems, ByVal pages.pElems, 0, 0, 0
CoTaskMemFree pages.pElems
End If
End Sub
Note that you pass in the Object property of the control, not the control reference itself. When you run this code, this will bring up the property pages of the controls at run-time. If you make any changes in the property pages and click OK, the changes will be reflected in the control.
Hop
e this helps.
- Elton