![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi,
I need to handle an event whenever we select something in mail body. Can anyone say how to handle this event and how to get selected text. I'm developing an outlook add-in in ATL COM(VC++) Regards Kiran. S |
Ads |
#2
|
|||
|
|||
![]()
There is no such event in the Outlook object model. If you are using
WordMail you can get Inspector.WordEditor as a Word.Document object and use the Word Object model for that. If you are using HTML then you would have to use the IHTMLDocument object model. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... Hi, I need to handle an event whenever we select something in mail body. Can anyone say how to handle this event and how to get selected text. I'm developing an outlook add-in in ATL COM(VC++) Regards Kiran. S |
#3
|
|||
|
|||
![]()
Thanks Ken,
I tried Word Object Model and tried to capture the WordEditor of an mail item. But inspector-get_WordEditor() is giving null pointer. Code: CComQIPtrOutlook::_Inspector spInspector; CComPtrMSWord::_Document spWordDoc; CComPtrMSWord::Selection spWordSelection; CComPtrMSWord::_Application spWordApp; spMailItem-get_GetInspector(&spInspector); CComPtrOutlook::_Application spApp; spInspector-get_EditorType(&editType); BSTR str; VARIANT_BOOL vTemp; spInspector-IsWordMail(&vTemp); if(vTemp == VARIANT_TRUE) { spInspector-get_WordEditor((IDispatch**)&spWordDoc); spWordDoc-get_Application(&spWordApp); spWordApp-get_Selection(&spWordSelection); spWordSelection-get_Text(&str); } Please let me know if any issue found. Regards Kiran. S "Ken Slovak - [MVP - Outlook]" wrote: There is no such event in the Outlook object model. If you are using WordMail you can get Inspector.WordEditor as a Word.Document object and use the Word Object model for that. If you are using HTML then you would have to use the IHTMLDocument object model. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... Hi, I need to handle an event whenever we select something in mail body. Can anyone say how to handle this event and how to get selected text. I'm developing an outlook add-in in ATL COM(VC++) Regards Kiran. S |
#4
|
|||
|
|||
![]()
Where are you calling that code?
I've seen, especially in Outlook 2007, that WordEditor is null up until the first Inspector.Activate() event. For example it's null in Inspectors.NewInspector() because you're only getting a weak object reference at that point. If there is no Inspector then obviously there can't be a WordEditor object since there is no Inspector. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... Thanks Ken, I tried Word Object Model and tried to capture the WordEditor of an mail item. But inspector-get_WordEditor() is giving null pointer. Code: CComQIPtrOutlook::_Inspector spInspector; CComPtrMSWord::_Document spWordDoc; CComPtrMSWord::Selection spWordSelection; CComPtrMSWord::_Application spWordApp; spMailItem-get_GetInspector(&spInspector); CComPtrOutlook::_Application spApp; spInspector-get_EditorType(&editType); BSTR str; VARIANT_BOOL vTemp; spInspector-IsWordMail(&vTemp); if(vTemp == VARIANT_TRUE) { spInspector-get_WordEditor((IDispatch**)&spWordDoc); spWordDoc-get_Application(&spWordApp); spWordApp-get_Selection(&spWordSelection); spWordSelection-get_Text(&str); } Please let me know if any issue found. Regards Kiran. S |
#5
|
|||
|
|||
![]() I'm call the code when we change mail item in main pane( BY handling Command-Bar events). I'm able to get Inspector pointer but its WordEditor is returning NULL. Using the below code to capture Inspector pointer. Code: CComPtr Outlook::SelectionspSelection; m_pExplorer-get_Selection(&spSelection); BSTR strname; if(spSelection) { CComPtr IDispatch spItem; CComVariant vCount(1); spSelection-Item(vCount,&spItem); if(!spItem) return; ATLASSERT(spItem); CComQIPtr Outlook::_MailItem spMailItem(spItem); ATLASSERT(spMailItem); fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n"); fflush(fileptr); CComQIPtrOutlook::_Inspector spInspector; spMailItem-get_GetInspector(&spInspector) } - Kiran. S "Ken Slovak - [MVP - Outlook]" wrote: Where are you calling that code? I've seen, especially in Outlook 2007, that WordEditor is null up until the first Inspector.Activate() event. For example it's null in Inspectors.NewInspector() because you're only getting a weak object reference at that point. If there is no Inspector then obviously there can't be a WordEditor object since there is no Inspector. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... Thanks Ken, I tried Word Object Model and tried to capture the WordEditor of an mail item. But inspector-get_WordEditor() is giving null pointer. Code: CComQIPtrOutlook::_Inspector spInspector; CComPtrMSWord::_Document spWordDoc; CComPtrMSWord::Selection spWordSelection; CComPtrMSWord::_Application spWordApp; spMailItem-get_GetInspector(&spInspector); CComPtrOutlook::_Application spApp; spInspector-get_EditorType(&editType); BSTR str; VARIANT_BOOL vTemp; spInspector-IsWordMail(&vTemp); if(vTemp == VARIANT_TRUE) { spInspector-get_WordEditor((IDispatch**)&spWordDoc); spWordDoc-get_Application(&spWordApp); spWordApp-get_Selection(&spWordSelection); spWordSelection-get_Text(&str); } Please let me know if any issue found. Regards Kiran. S |
#6
|
|||
|
|||
![]()
You would need to display the Inspector.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... I'm call the code when we change mail item in main pane( BY handling Command-Bar events). I'm able to get Inspector pointer but its WordEditor is returning NULL. Using the below code to capture Inspector pointer. Code: CComPtr Outlook::SelectionspSelection; m_pExplorer-get_Selection(&spSelection); BSTR strname; if(spSelection) { CComPtr IDispatch spItem; CComVariant vCount(1); spSelection-Item(vCount,&spItem); if(!spItem) return; ATLASSERT(spItem); CComQIPtr Outlook::_MailItem spMailItem(spItem); ATLASSERT(spMailItem); fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n"); fflush(fileptr); CComQIPtrOutlook::_Inspector spInspector; spMailItem-get_GetInspector(&spInspector) } - Kiran. S |
#7
|
|||
|
|||
![]()
can you tell me which event is needed to handle , when we select the text in
outlook 2007. -Kiran.S "Ken Slovak - [MVP - Outlook]" wrote: You would need to display the Inspector. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... I'm call the code when we change mail item in main pane( BY handling Command-Bar events). I'm able to get Inspector pointer but its WordEditor is returning NULL. Using the below code to capture Inspector pointer. Code: CComPtr Outlook::SelectionspSelection; m_pExplorer-get_Selection(&spSelection); BSTR strname; if(spSelection) { CComPtr IDispatch spItem; CComVariant vCount(1); spSelection-Item(vCount,&spItem); if(!spItem) return; ATLASSERT(spItem); CComQIPtr Outlook::_MailItem spMailItem(spItem); ATLASSERT(spMailItem); fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n"); fflush(fileptr); CComQIPtrOutlook::_Inspector spInspector; spMailItem-get_GetInspector(&spInspector) } - Kiran. S |
#8
|
|||
|
|||
![]()
There is no event for that in the Outlook object model.
You'd have to open the item so it was being handled by WordMail, get Inspector.WordEditor as a Word.Document object, then get the Parent property of that as Word.Application and use the Word.Application.WindowSelectionChange() event. If the text was selected in the reading pane I don't know of a way to get an event for that at all. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "pasteface method crashing outlook" oft.com wrote in message ... can you tell me which event is needed to handle , when we select the text in outlook 2007. -Kiran.S |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reply with custom form & selected data from message body | GregoryL.[AITI] | Outlook and VBA | 3 | May 28th 09 03:46 PM |
Copying selected text from a message body | CharlieH | Outlook and VBA | 4 | December 2nd 08 03:16 PM |
How Do I determing what text is currently selected in message body | Don | Outlook and VBA | 4 | August 23rd 07 02:38 PM |
IMPORTANT Software-Development: How to identify the body/sender/recipient when the selected message is changed | Kevin Stumpf | Outlook Express | 1 | June 20th 06 11:46 AM |
Can't see message body until Reply or Fwd is selected | Jen | Outlook - General Queries | 0 | March 16th 06 02:31 PM |