Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / June 2005

Tip: Looking for answers? Try searching our database.

2002 vs 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sektor - 22 Jun 2005 15:30 GMT
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
Dmitry Streblechenko - 22 Jun 2005 19:35 GMT
Are you using the same kind of editor in both versions (built-in vs Word)?
Note that the Word editor will disable some of its menu items if the
inspector does not have the focus.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> Look this piece of code for Outlook 2002:
>  Outlook::_Inspector* spInsp = g_ppvApplication->ActiveInspector();
[quoted text clipped - 47 lines]
> Thanks in advance.
> Sektor
Sektor - 23 Jun 2005 21:19 GMT
Thanks Dmitry,
When I tried the plug-in with 2002 the focus was on the inspector (the
plug-in was activated by a button in the inspector), but when I tried with
2003 the focus was not on the inspector (plug-in activated by a pop-up
menu).
So, as you suggested, I put the focus on the inspector (spInsp->Activate()):
the buttons "select all" and "paste" are now enabled.

The problem is the same either I use the built-in editor or Word editor and
the solution is just the same: the inspector must have the focus (as Dmitry
said).

Bye
Sektor

> Are you using the same kind of editor in both versions (built-in vs Word)?
> Note that the Word editor will disable some of its menu items if the
[quoted text clipped - 56 lines]
>> Thanks in advance.
>> Sektor
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.