Cannot hook outlook buildin control

Add-in Express™ Support Service
That's what is more important than anything else

Cannot hook outlook buildin control
 
henry


Guest


Dear Sirs,

I have followed the sample in the Developer's Guide and successfully hook the Excel event.
However, when I try to hook the send button event in outlook email page, it doesn't work.
I have used Build-in Control Scanner to find the ID of the Send button.
I then:
set XLAutomationAddIn=true
set DisableStandardAction=true
create OnAction handler to showmessage('hello')
After I build and register the dll, I launch outlook,
but when I click on the send button, it still behave as usual without showing my hello message.


Could you give me some hint?
Thank you very much.
Posted 14 Aug, 2004 21:25:11 Top
Henry


Guest


I forget to mention that I use Outlook 2003. And the Build in Control Scanner return two values for Send button: 2617 and 5469.
I have tried both IDs, but neither one works.
Posted 14 Aug, 2004 21:32:19 Top
Dmitry Kostochko


Add-in Express team


Posts: 2740
Joined: 2004-04-05
Hello Henry,

Firstly you don't need to set XLAutomationAddIn property to True. This property is used when host application is Excel only.

To hook Outlook Send button you are to do the following:
- add to your add-in module the TadxOLInspectorCommandBar component.
- set its CommandBarName property to 'Standard'.
- add to your add-in module the TadxBuiltInControl component.
- set the CommandBar property to the added TadxOLInspectorCommandBar component.
- set the BuiltInID property to 2617.
- handle the OnAction event.

Sincerely,
ADX Support Team
Posted 16 Aug, 2004 06:12:34 Top
Henry


Guest


Hi Dmitry,

It works as you said!
Thank you very much for your help.

By the way, I just wonder whether Add-in Express can be used to hook Send button event in Outlook Express, not just Outlook?

Regards,

Henry
Posted 16 Aug, 2004 19:37:22 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hi Henry,

Outlook Express doesn't support the COM Add-in technology that Add-in Express is based on. That is why you cannot use our ADX to develope add-ins for OE.
Posted 17 Aug, 2004 02:30:53 Top
Henry


Guest


Thank you, Eugene.
But I have another question.

If Microsoft Word is selected as email editor, which is a default configuration in Outlook, then my program cannot hook the send button inside Microsoft Word.

Actually, if I set Microsoft Word as email editor, and use "Build-in Control Scanner" to scan the program, I cannot find the Send button in the scanned result. So I don't know what control ID I should use.

According to MSDN, the ActiveInspector equal to nothing in such situation:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaol10/html/olmthActiveInspector.asp

Without ActiveInspector, how can I use the object model to get item detail?

Thank you.
Posted 17 Aug, 2004 05:24:00 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Henry,

Yes, you are right. In the case when Word is a default e-mail editor there is no way to hook the button.

But I don't undestand why the Send button should be handled. Outlook provides the ItemSend event:

"Before the inspector is closed, but after the user clicks the Send button".

Even more effective way is using Easy MAPI (or Extended MAPI directly) and its events.
Posted 17 Aug, 2004 05:45:43 Top
Henry


Guest


Hi Eugene,

Thank you for your reply.
Actually I am quite new to Outlook programming, so I might not know the right tool for our project yet.

We build this project for a school customer.
The goal is to maintain a central contact book at the server side instead of storing many contact records on different client PC.
Also the contact name is non-English.
When user compose an Outlook email, he simply type in the NON-ENGLISH contact name as recipient and click on send button. Then our add-in (or VBA program) should intercept the send event and query the server to convert the non-English contact name into English email address.

Now, my understanding is that if we use ItemSend event handler, we have to use VbjProject.OTM.
It seems that the only deployment option for VbjProject.OTM is to ask users to import the class file in Outlook Visual Basic Editor.
We prefer an installation process instead of such importing process.

If we should use add-in, then one way of doing it is to hook the Send button.
However, as we discussed above, it is impossible to hook the send button inside Microsoft Word.

Now, do you have any suggestion about what is the right way to do our project? Is Easy MAPI (or Extended MAPI directly) the right tool?

Thank you very much.


Regards,

Henry
Posted 17 Aug, 2004 20:17:31 Top
Dmitry Kostochko


Add-in Express team


Posts: 2740
Joined: 2004-04-05
An interesting project. Can I ask some more questions?

What software does your "school customer" use (Outlook versions and OS versions)? Has he got MS Exchange server?

Sincerely,
ADX Support Team
Posted 18 Aug, 2004 05:47:04 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hi Henry,

Here I see a lot of pitfalls you can come across. When I was thinking over your project some times it seemed to me it would be easier to develop a new e-mail client ;)

Pitfalls
1. If the user doesn't fill in the To field and clicks the Send button, Outlook fires a warning.

2. OK. This warning seems possible to avoid, if the user fills in the To field with "the NON-ENGLISH contact name". Nope. And it this case Outlook shows a warning if this contact name isn't found in the Address Book.

3. There is no event that looks like... hmm... OnBeforeOutlookCheckAllMessageFields :D

4. That is why we come to the conclusion that before clicking the Send button the user should fill in the To field. Agree?

5. To fill in this field we can add a new button to the message window that just helps us to find and select the recepients we need. To do this we will just build a nice dialog box.

When I say "we" I mean you and I. Any comments or ideas?
Posted 18 Aug, 2004 06:36:42 Top