tags:

views:

47

answers:

1

I want to create a rectangle dynamically in visio with C++ code. The Visio API has a function drawRectangle which creates a rectangle but does not return a handle to it. Is there an in built function which returns the rectangle object? If not, What should be the code to create this rectangle?

A: 

DrawRectangle returns a HRESULT (it’s a COM API) and sets the last parameter to be the shape created. If you are using the wrapper classes included in the Visio SDK this will be a CVisioShape&. If you are calling the APIs directly or using some other COM wrappers, e.g. you used the #import directive, the type parameter will be IVShape* or some wrapper around it.

Pat Leahy