G
Guest
Look this piece of code for Outlook 2002:
Outlook::_Inspector* spInsp = g_ppvApplication->ActiveInspector();
Office::_CommandBars *bars = spInsp->CommandBars;
Office::CommandBar *bar = bars->ActiveMenuBar;
Office::CommandBarControls *ctrls1 = bar->Controls;
Office::CommandBarPopupPtr popm =
(Office::CommandBarPopupPtr)(ctrls1->GetItem("edit"));
Office::CommandBarControlsPtr ctrls2 = popm->Controls;
Office::_CommandBarButtonPtr btn1 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("edit message"));
Office::_CommandBarButtonPtr btn2 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("select all"));
Office::_CommandBarButtonPtr btn3 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("paste"));
btn1->Execute();
btn2->Execute();
HGLOBAL hData;
LPVOID pData;
BOOL r;
r = OpenClipboard(NULL);
UINT hRTF = RegisterClipboardFormat(CF_RTF); //("Rich Text Format")
r = EmptyClipboard();
hData = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, strPlain.length() + 1);
pData = GlobalLock(hData);
strcpy((LPSTR)pData, rtfData);
GlobalUnlock(hData);
HANDLE h = SetClipboardData(hRTF, hData);
r = CloseClipboard();
bool b = btn3->Enabled;
if (b)
btn3->Execute();
else
{
MessageBox(NULL, "Paste Execute", "Error", MB_OK);
}
It works for Outlook 2002, but if I modify it for Outlook 2003 it doesn't
work: the "select all" button seems to be disabled and the same is for the
paste button.
Does anyone know if these buttons has been disabled in Outlook 2003 to avoid
security problem?
As you can see this method could be used in order to create an RTF mail
pasting the data directly in the mail body, without using the outlook body
property which doesn't support the RTF. In Outlook 2002 works!
Thanks in advance.
Sektor
Outlook::_Inspector* spInsp = g_ppvApplication->ActiveInspector();
Office::_CommandBars *bars = spInsp->CommandBars;
Office::CommandBar *bar = bars->ActiveMenuBar;
Office::CommandBarControls *ctrls1 = bar->Controls;
Office::CommandBarPopupPtr popm =
(Office::CommandBarPopupPtr)(ctrls1->GetItem("edit"));
Office::CommandBarControlsPtr ctrls2 = popm->Controls;
Office::_CommandBarButtonPtr btn1 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("edit message"));
Office::_CommandBarButtonPtr btn2 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("select all"));
Office::_CommandBarButtonPtr btn3 =
(Office::_CommandBarButtonPtr)(ctrls2->GetItem("paste"));
btn1->Execute();
btn2->Execute();
HGLOBAL hData;
LPVOID pData;
BOOL r;
r = OpenClipboard(NULL);
UINT hRTF = RegisterClipboardFormat(CF_RTF); //("Rich Text Format")
r = EmptyClipboard();
hData = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, strPlain.length() + 1);
pData = GlobalLock(hData);
strcpy((LPSTR)pData, rtfData);
GlobalUnlock(hData);
HANDLE h = SetClipboardData(hRTF, hData);
r = CloseClipboard();
bool b = btn3->Enabled;
if (b)
btn3->Execute();
else
{
MessageBox(NULL, "Paste Execute", "Error", MB_OK);
}
It works for Outlook 2002, but if I modify it for Outlook 2003 it doesn't
work: the "select all" button seems to be disabled and the same is for the
paste button.
Does anyone know if these buttons has been disabled in Outlook 2003 to avoid
security problem?
As you can see this method could be used in order to create an RTF mail
pasting the data directly in the mail body, without using the outlook body
property which doesn't support the RTF. In Outlook 2002 works!
Thanks in advance.
Sektor