D
David
Hellllo.
I have COM addin (ATL7, C++) for MS Word. My GUI is a commandbar with some
buttons and combo boxes. I'm, adding CommandBar object to Word CommandBars
collection - usual way. Im setting folowing properties :
CComVariant vtName(_T("MY_COMMANDBAR_NAME"));
CComVariant vtPos(msoBarLeft|msoBarTop);
CComVariant vtEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vtTemp(VARIANT_TRUE); // is temporary
m_OCmdBar = m_OCmdBars ->Add(vtName,vtPos, vtEmpty, vtTemp);
m_OCmdBar->get_Protection(&m_barProtect);
m_OCmdBar->Protection = msoBarNoCustomize;
m_OCmdBar->put_NameLocal(_bstr_t("My Commad Bar"));
m_OCmdBar->put_Visible(VARIANT_TRUE);
Eevrything works fine command bar is displayed etc. The problem begins with
Outlook. If Word is default email editor in Outlook I have hundreds of
problems operating my addin in Outlook (this is diffrernt story I can write a
book about this mess), therefore I decide to disable and do not show my
adddin toolbar while documnet container is an Outlook email message.
Im just setting :
m_OCmdBar->put_Visible(VARIANT_FALSE);
m_OCmdBar->put_Enabled(VARIANT_FALSE);
Im doing this each time while handling OnDocumentChange event. This works
fine in Outlook, addin bar "disappears" , Each time Im checking if currrent
document is not mail Im setting these properties back :
m_OCmdBar->put_Visible(VARIANT_TRUE);
m_OCmdBar->put_Enabled(VARIANT_TRUE);
However this code doesnot work if Outlook hosts Word doc.
When Im opening regular Word document CommandBar does not appear in Word
window, despite Visiible = true code execution !!! , Im checking HRESULT, try
, catch , nothing fails! It is possible to rightclick on tolbars select my
CommandBar and display it , BUT I HAVE TO DO this from my code, user cannot
search for the command bar each tiome it disappaears.
This problem happens ONLY when using Outlook , BFFORE regular Word dcoumnet
is being opened. If I open Word first and then Outlook evrything works fine
CommandBar is visible /invisible as it should be according to my code.
Pleas help!!! What can I do with Outlook? Any workaround ?
thqanks, David
I have COM addin (ATL7, C++) for MS Word. My GUI is a commandbar with some
buttons and combo boxes. I'm, adding CommandBar object to Word CommandBars
collection - usual way. Im setting folowing properties :
CComVariant vtName(_T("MY_COMMANDBAR_NAME"));
CComVariant vtPos(msoBarLeft|msoBarTop);
CComVariant vtEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
CComVariant vtTemp(VARIANT_TRUE); // is temporary
m_OCmdBar = m_OCmdBars ->Add(vtName,vtPos, vtEmpty, vtTemp);
m_OCmdBar->get_Protection(&m_barProtect);
m_OCmdBar->Protection = msoBarNoCustomize;
m_OCmdBar->put_NameLocal(_bstr_t("My Commad Bar"));
m_OCmdBar->put_Visible(VARIANT_TRUE);
Eevrything works fine command bar is displayed etc. The problem begins with
Outlook. If Word is default email editor in Outlook I have hundreds of
problems operating my addin in Outlook (this is diffrernt story I can write a
book about this mess), therefore I decide to disable and do not show my
adddin toolbar while documnet container is an Outlook email message.
Im just setting :
m_OCmdBar->put_Visible(VARIANT_FALSE);
m_OCmdBar->put_Enabled(VARIANT_FALSE);
Im doing this each time while handling OnDocumentChange event. This works
fine in Outlook, addin bar "disappears" , Each time Im checking if currrent
document is not mail Im setting these properties back :
m_OCmdBar->put_Visible(VARIANT_TRUE);
m_OCmdBar->put_Enabled(VARIANT_TRUE);
However this code doesnot work if Outlook hosts Word doc.
When Im opening regular Word document CommandBar does not appear in Word
window, despite Visiible = true code execution !!! , Im checking HRESULT, try
, catch , nothing fails! It is possible to rightclick on tolbars select my
CommandBar and display it , BUT I HAVE TO DO this from my code, user cannot
search for the command bar each tiome it disappaears.
This problem happens ONLY when using Outlook , BFFORE regular Word dcoumnet
is being opened. If I open Word first and then Outlook evrything works fine
CommandBar is visible /invisible as it should be according to my code.
Pleas help!!! What can I do with Outlook? Any workaround ?
thqanks, David