Sinking combobox events for multiple documents

A

Alex Korchemniy

I created an ATL COM addin for Microsoft Word. I am having a problem with
combo boxes. I create the combo boxes with the application first start and I
sink the events for them. When I have multiple documents opened I end up
pulling data and receiving events only for the first instance of the combo
box.

After realizing that my approach was flawed I attempted to catch the "New"
and "Open" document events and start an instance of a document wrapper class
that I created. However this again fails. Somehow the events get mangled.
Maybe I'm on the right track but not there all the way.

What is the correct way of using combo boxes in a commandbar with multiple
Word documents??
 
D

David

Hi Alex
I guess I have the same problem. Actually these are not only combos but all
controls. I have couple of buttons and combos on my toolbar. I use DispEvents
stuff . It is possible to handle events only in first document window, rest
windows do not recieve events at all, I can change combo but no event is
fired (like you describe). However while I change anyhting on the first doc
the rest of the windows got updated. May be it is somethign connected ti
Protection level of toolbar?
I will try couple of tricks and will inform you in case somethign
interesting happens. Please keep me update if you have any results/ideas.
thanks David
 
A

Alex Korchemniy

I got frustrated with this problem and also poor 97 support and had my
partner port everything to VBA. He had the same problem again. Try doing
this... when the document changes find the control again (since they seem to
be document specific) save the reference, and reattach the events. I hope
this helps you out.

~ Alex Korchemniy
 

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