Load add-in on Outlook 2003 startup

G

goran

Hi,

I developed a com Add-in for Outlook 2003. I copied it at user
profile/addins folder. What do I need to do so this add in will load
automatically when Outlook starts?

Thanks,

Goran
 
G

goran

Ken,

I try everything and cannot get my addin to load and show in the toolbar
when Outlook starts. I have to do it manually and then is OK. I set 'Initial
Load Behavior' to 3. I copied the addin dll to my user profile under
Application Data/microsoft/AddInns. When I start the outlook the add in is
not there. I have to go manually to Tools/Options/Other/ Advanced options/COM
Addins and browse for my dll there and then it will load it. Please tell me
if there is another way to install it so it will load and show when Outlook
starts. Can I use VB 'PAckage & deployment' tool to package it, or any other
tool?

Thanks for you help as always.

Goran
 
K

Ken Slovak - [MVP - Outlook]

Normally a COM addin gets installed somewhere under Program Files, although
that's not a requirement. Usually that AddIns folder is used for Exchange
addins (ECE files written using Extended MAPI code).

Outlook will recognize any COM addin, no matter where it's installed, if
it's registered correctly. You should not have to browse for the addin, it
should show up in the COM AddIns dialog if it was registered in the HKCU
hive of the registry and the addin dll was registered also. If you used a
VB6 Designer then registering the addin dll will take care of writing the
keys to the registry in HKCU for you.

How you install is up to you. The P&D Wizard works but it creates large
installers that include lots of stuff that you really don't need to deploy,
like the VB6 runtime (msvbvm6.dll) and so on. Those packages also don't give
you the flexibility that a Windows Installer package provides. You can use
Windows Installer, a commercial package such as InstallShield or Wise, or
even an installation bat file. All you really need to do is put the files
where you want and run regsvr32 on the addin dll.

If you look in the registry at HKCU\Software\Microsoft\Office\Outlook\Addins
do you see your addin listed? Does it have the correct registry keys as
listed in that link I provided? If not that's the problem and you should
read the article at that link.
 
G

goran

Ken,
Sorry to bother you again, but this is driving me crazy. My Add-in adds a
dropdowncombo on every mail inspector toolbar. When user selects something
from dropdowncombo, new modal form dialog opens on the top of the inspector.
I used SetwindowPos to set this small dialog on the top and also used
SetForegroundWindow for inspector window. However when I click on the modal
form Inspector window gets minimized and whatever window is under becomes
foreground. When I close modal dialog form, Inspector gets active and it
shows. I get hWnd of the inspector on Inspector activate event and use that
handle to set inspector as foreground window inn modal form activate event.
No matter what I do inspector window flashes and gets minimized when I click
on anything on modal form. I need the inspector to stay in place until modal
form is closed. Any ideas how to fix this? This only happens when email
editor is WordMail and when dll compiled, in design mode everything is OK.

Thanks in advance,

Goran
 
K

Ken Slovak - [MVP - Outlook]

I've never seen or heard of that but it's most likely that you're getting
the hWnd for an incorrect window. Get the hWnd and then use Spy++ to see
what window handle you're actually getting.
 
G

goran

I checked in Spy++. I have correct OpusApp window handle.I can't believe it
neither.

I have this on dropdown change event that suppose to launch dialog form:

SetWindowPos(frmDialog.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or
SWP_NOMOVE)

frmDialog.Show 1

then on Inspector_Activate I have:

hw = FindWindow("OpusApp", vbNullString) this is where I capture Inspector
Handle

and on dialog form Activate event I try to set Inspector as foreground
window like:

Form1_Activate()
SetForegroundWindow(hw)
end sub

And when I click dialog form Inspector window which is foreground window
gets minimized. I even tried SetActiveWindow(hw), ShowWindow hw,
SW_SHOWACTIVATE etc to keep Inspector from dissapearing. I event put code in
Inspector_Deactivate event to check if DialogForm is visible, If it is I call
inspector.activate method. That does help sometimes but not always. Any ideas
what should I try?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

You need to set the z-order of the Inspector window before you set the form
dialog's z-order. I usually use SetWindowLong to make the Inspector window
parented by the main Outlook window, then I make the dialog window a child
of the Inspector window. I try to avoid SetWindowPos() with HWND_TOPMOST
because if the user clicks in a completely different application the dialog
using HWND_TOPMOST still remains on top and that tends to completely annoy
users.
 
G

goran

Thanks Ken.
Do I call open dialog form as modal or not (Form1.show 1).I realize that my
problem is that I need to stop execution in the code in inspector window when
dialog form pops up, and wait for the dialog form to be closed and pass the
value to the dropdown on the inspector and based on passed value continue
execution in the inspector.
 
K

Ken Slovak - [MVP - Outlook]

You can try that or you can use a loop that checks for a public boolean in
the dialog that's only set based on some condition. See what works best for
you.
 
G

goran

thanks. And if I have multiple "OpusApp" windows opened and all of them by
default have the same caption "Untitled Message" when I use FindWindow how do
I get handle from current one as oppose from any that are already opened.

Thanks a lot for your time and help,

Goran
 
K

Ken Slovak - [MVP - Outlook]

Set the caption. Or look at all the handled windows and their hWnd's and see
which window isn't being handled. I usually store the hWnd for the window in
my Inspector wrapper class so I have a reference to it at all times for
things like that.
 
G

goran

Ok, but what do you mean by "handled Windows"

Ken Slovak - said:
Set the caption. Or look at all the handled windows and their hWnd's and see
which window isn't being handled. I usually store the hWnd for the window in
my Inspector wrapper class so I have a reference to it at all times for
things like that.
 
G

goran

And Caption is read only

Ken Slovak - said:
Set the caption. Or look at all the handled windows and their hWnd's and see
which window isn't being handled. I usually store the hWnd for the window in
my Inspector wrapper class so I have a reference to it at all times for
things like that.
 
K

Ken Slovak - [MVP - Outlook]

If you set the Subject of the email item that changes the caption.
 
K

Ken Slovak - [MVP - Outlook]

I mean windows that are being handled in your Inspector wrapper classes and
wrapper collection.
 
G

goran

Hi Ken,

Sorry to use this old thread, but this is the best way to get to you. I use
your add-in wrapper to develop Outlook 2003 add-in with VB 6. It looks OK.
Now I want to use this add-in with Outlook 2007 and I have a problem when it
tries to installFeature(CDO). I installed CDO manually myself. Do I need to
check for CDO if I know that machine has it installed because I installed it
manually?

Thanks,

Goran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top