Find shapes at all layers at all pages in C++

M

Mr

Hi all,

I need help to implement the following Visual Basic code in C++

====================================================
====================================================
Public Sub LayersContent2()
Dim PagObj As Visio.Page
Dim layersObj As Visio.Layers, layerObj As Visio.Layer
Dim shpsObj As Visio.Shapes, shpObj As Visio.Shape
Dim I As Long, N As Long

For Each PagObj In ActiveDocument.Pages
For Each shpObj In PagObj.Shapes
N = shpObj.LayerCount
If N > 0 Then
For I = 1 To N
Set layerObj = shpObj.Layer(I)
Debug.Print PagObj.Name; " "; shpObj.Name; " ";layerObj.Name
Next I
End If
Next ShpObj
Next PagObj
End Sub
====================================================
====================================================
Note I have found this code at www.mvps.org/visio/vba.htm
====================================================

I've built windows form application and add to it visio ActiveX my
visio object name is DrowingControl1

Thanks
 
J

JuneTheSecond

All shapes might be found in each shapes in each pages.
The shape object has LayerCount propery and Layer
property, so you might be able to see in which layers
a shape belongs, because Visio' layer is not the real
existence, but is just a property of the shapes.
There might be found any example in Visio Information.
http://www.mvps.org/visio/VBA.htm. or in Visio2003 SDK
Code Liabrarian.
 
M

Mr

Hi,

Thanks for the fast response...
My problem is that I do not know how to move between the pages / layers
/ shapes

For example I found the number of pages with:
DrawingControl1->Document->Pages->Count
but now how do I move between the first page second page and so on?
In vb you use: "For Each PagObj In ActiveDocument.Pages" and you move
between the page objects (I think)
but in C++ I'll use someting like: "for( index = 0; index <
DrawingControl1->Document->Pages->Count; index++ )" and I just stepping
the index but not moving between the pages.
How do I move to the second page (and so on)?

Thanks
 
H

Heidi Munson [MSFT]

Use the item property on the Pages collection.

For sample code in C++ see the Flowchart add-on in the Visio 2003 SDK. It
is using #import to create wrapper classes for the Visio COM Interfaces.
The syntax for accessing properties tends to vary depending on what
mechanism you used to create wrapper classes. The Visio SDK also provides
visiwrap wrapper classes.

You can download the Visio 2003 SDK here,
http://www.microsoft.com/downloads/...bd-b0bb-46e7-936a-b8539898d44d&displaylang=en

-Heidi
Microsoft Corp

This posting is provided "AS IS" with no warranties, and confers no rights
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top