ActiveX OnSize and OnMove messages in PowerPoint

E

EatenByAGrue

I have a simple ActiveX project I've added to my solution, generated from the
Visual Studio wizard (ActiveX MFC project). I have added C++ code to my
solution that uses the Office Object Model to add my ActiveX to any
particular slide (using Shapes.AddOLEObject). I need to know whenever my
ActiveX is moved or resized, so I figured it would be easy enough to just
listen for the appropriate events with OnMove or OnSize. Sadly, these never
get called from PowerPoint, with one exception. If I enter Slide Show mode
in PowerPoint, OnMove and OnSize immediately get called. How can I trap
these events in normal editing mode in PowerPoint?
 
S

Steve Rindsberg

EatenByAGrue said:
I have a simple ActiveX project I've added to my solution, generated from the
Visual Studio wizard (ActiveX MFC project). I have added C++ code to my
solution that uses the Office Object Model to add my ActiveX to any
particular slide (using Shapes.AddOLEObject). I need to know whenever my
ActiveX is moved or resized, so I figured it would be easy enough to just
listen for the appropriate events with OnMove or OnSize. Sadly, these never
get called from PowerPoint, with one exception. If I enter Slide Show mode
in PowerPoint, OnMove and OnSize immediately get called. How can I trap
these events in normal editing mode in PowerPoint?

I'm guessing that OnMove and OnSize are application or window events; they're
not part of the PPT object model.

PPT does have a selection change event that you could work with.
 
E

EatenByAGrue

Unfortunately, the problem I have is that I need to modify other Shapes when
this particular Shape is moved or resized. I looked over the PPT events, but
I didn't see anything that looked like what I need. I figured that the
ActiveX object would be part of the Windows event system, but that appears to
only be valid when I'm viewing the slide show, not editing. I guess I could
just capture the WindowActivate, WindowDeactivate, and WindowSelectionChange
and handle my adjustment through them. A shame to have to go through what
seems like a less intuitive route to solve the problem, but if that's all I
have to work with then that's all I can do :) Thanks for your suggestion!
 
A

Austin Myers

Hmmm,

Couldn't you set a "mousedown" event on the control and then track the
cursors movement/position? If it changes you know the controls
position/size has been altered.


Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com
 
E

EatenByAGrue

I tried adding a mouse listener to it, but I am not getting those messages,
either. The only event I've noticed that is actually being reported while
editing in PowerPoint is the paint. I think that it all may have to do with
OLE's difference between edit mode and user mode, but I tried overriding the
calls that set that boolean value and it never gets called, either.
 
S

Steve Rindsberg

Unfortunately, the problem I have is that I need to modify other Shapes when
this particular Shape is moved or resized. I looked over the PPT events, but
I didn't see anything that looked like what I need. I figured that the
ActiveX object would be part of the Windows event system, but that appears to
only be valid when I'm viewing the slide show, not editing. I guess I could
just capture the WindowActivate, WindowDeactivate, and WindowSelectionChange
and handle my adjustment through them. A shame to have to go through what
seems like a less intuitive route to solve the problem, but if that's all I
have to work with then that's all I can do :) Thanks for your suggestion!

See Austin's suggestion also ...

Agreed, more events would be handy, but we have to work with what we're given.

Give your ActiveX shape a unique name or better, tag it when you insert it.

Then the selection change event can examine the currently selected shape's tags to
see if it's your ActiveX object. If so, set a flag to indicate that your shape has
been selected.

The next time the sel change event fires, if this flag is set, you know that your
shape WAS selected but now something else is, so have a look at its coordinates (and
perhaps compare them to values you've tagged the shape with previously)
 
E

EatenByAGrue

Yep, that's pretty much what I'm doing now :) Thanks for the suggestions.
As for Austin's suggestion, I tried adding a mouse listener and still got
nothing. Did I misunderstand the concept he was describing?
 
S

Steve Rindsberg

Yep, that's pretty much what I'm doing now :) Thanks for the suggestions.
As for Austin's suggestion, I tried adding a mouse listener and still got
nothing. Did I misunderstand the concept he was describing?

I think for his suggestion to work, it'd require that the ActiveX control fire events
while PPT is in edit mode, and typically that's not going to happen. But maybe *I'm*
 

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