Hi, ken, thank you for your help. I write a wrapper class, and flow is change
1.) In OnConnection, NewInspector:
2.) In NewInspector event: CInspWrapper * pInsp = new CInspWrapper(Outlook::
then add pInsp to a list, say "InspList".
3.) In CInspWrapper, CloseInspector:
ispEventAdvise, and create UI. when
user click close,
UnAdvise current inspector and remove UI .(here i don't know how to
remove the killed
CInspWrapper in "InspList",
so i decide to free all memory in OnDisconnection method).
4.) User close outlook, then in OnDisconnection, UnAdvise NewInspector event,
and free all pointer
(hold memory) from new CInspWrapper.
If wordedit is not use, this work fine, else it is sees quite unexcept. From
your previous post, i got an idea, that's is wordedit is in use, i should
find the commandbar, if it is exist, just put it visiable, else create it, am
Here i have i little trouble, how to find exist CommandBar in CommandBars??
it seems that CommandBars only have FindControl method, Should i use
Sorry for so much questions, and thanks very much for your help.
> If you have a wrapper class that holds the Inspector, current item, Key,
> etc., it also handles the Inspector and item events. I mentioned that. So
> when Inspector.Close() fires it fires only in that one wrapper class
> instance. The class instance knows who it is from the stored Key value. It
> can access it's own UI that way, and access it's place in the list. So it
> can also remove itself from the list.
> As far as not creating multiple copies of the UI, that's what flags are for.
> You set one flag in the wrapper class when the class is created, call it
> _startup. You can also create another flag _uiCreated. You check the flag
> logic to see if startup initializations and UI creation need to be done. You
> can also combine both flags into one if you only need one flag.
> >>Yes, it's better to create UI in Activate(), as I said.
> > Every time the inspector is focused, this function is called, it may
> [quoted text clipped - 25 lines]
> >>MsoButtonState.msoButtonUp looks not pushed in.
> > OK, got it, thanks again.