А вот еще вопрос: Как правильно работать с пользовательскими окнами Visio? Ну т.е. мне нужно создать окно аналогичное окну "Данные фигуры", но со своим содержимым. В SDK приведен такой пример:
The following macro shows how to use the Add method to add a Window object to the Windows collection. It creates a new, empty parent frame window, docked to the bottom of the drawing window. Then it populates the new parent frame window with a child window, in this case a form, so that the new window does not appear empty.
Add a form to your Microsoft Visual Basic (VBA) project called frmMain, and then add a TextBox control named txtForm to the form.
The SetParent, FindWindow, and SetWindowLongLib functions are from the Windows API, and are necessary to add the form to the new window.
Add the following code to the form module to resize the text box when the form is resized:
Visual Basic for Applications
Private Sub UserForm_Resize()
txtForm.Width = txtForm.Parent.Width - 10
txtForm.Height = txtForm.Parent.Height - 10
End Sub
Then add the following code to the document project:
Visual Basic for Applications
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Public Sub AddWindow_Example()
Dim vsoWindow As Visio.Window
Dim frmNewWindow As UserForm
Dim lngFormHandle As Long
'Add a new Anchor Bar window docked to the bottom of the Visio drawing window
Set vsoWindow = ActiveWindow.Windows.Add("My New Window", visWSVisible + visWSDockedBottom, visAnchorBarAddon, , , 300, 210)
'Create a new windows form
Set frmNewWindow = New frmMain
'Get the 32-bit handle of the new window.
lngFormHandle = FindWindow(vbNullString, "My New Window")
SetWindowLong lngFormHandle, GWL_STYLE, WS_CHILD Or WS_VISIBLE
SetParent lngFormHandle, vsoWindow.WindowHandle32
End Sub
Окно появляется, что, вобщем то и неудивительно, а вот содержимое формы frmMain появляться не хочет. В чем дело - не пойму. Может кто сталкивался? Заранее благодарен.