Com Add-in Question?

  • Thread starter Thread starter Kristy
  • Start date Start date
K

Kristy

Hi

I have created a com addin for Outlook and am using a Designer
(actually I use 2, one for Word and one for Outlook).

The designer registers the dll automatically to HKCU but I need to use
HKLM.

I have been using Visual Studio installer (.msi) to install my
application and set the following registry keys in
HKLM\Software\Microsoft\Addins\Outlook\Addins\MyAddin.Connect

CommandLineSafe = 0
LoadBehaviour = 3
Description = "My Addin"
FriendlyName = "My Addin"

I also need to use Orca to change the Property table to ALL USERS = 2

This works, except that the dll still registers to HKCU as well, I
read that this is because VB is adding my additional settings to the
DllRegisterServer and DllunregisterServer instead of replacing them.
So far I have just been manually deleting the HKCU entries but have
noticed that each time the server (in this case a citrix server)is
rebooted the HKCU entries come back and this often causes the load
behaviour in HKLM to change to 2, which is a disaster!

The options I have found so far are:

1. Use the installation package to create the registry entries but do
not register the addin dll. So I changed the dll in the installer to
'0'(do not self register), but this didn't work (Ther were no HKCU
settings and HKLM was as expected but the addin didn't load), so what
other entries do I need to make?

2. Don't use a designer just set up IDTExtensibilty2 in a class module
and set up HKLM and other registry keys using the installer. Again,
unsure of all the keys required to do this?

3. Use regOverridePredefKey API to tell the OS to use HKLM instead of
HKCU. This sounds scary but if it is the best way then I'm willing to
give it a go... any code samples or advise would be greatly
appreciated :-)

I guess I'm really after some advise from someone who is very
knowledgable on the best, most reliable, stable way to deal with this.
I am also planing on using InstallShield in the future which may have
more options... any suggestions?????

Thanks

Kris
 
Is the addin registered in HKEY_USERS? If that's the case then the settings
are being copied to HKCU when the user logs in. Never set up an addin to
register in both HKLM and HKCU, that can cause all sorts of problems.

I use InstallShield myself, along with a standard designer in my COM addin.
I set up the registry in HKLM if I want the addin registered there by
creating the needed entries in the HKLM section of the InstallShield
registry settings and that's it. I don't do anything else.

The necessary entries are:
CommandLineSafe (DWORD) 0
Description (String) "Whatever you want"
FriendlyName (String) "Whatever you want"
LoadBehavior (DWORD) usually 3 in most cases
 
Hi Ken

I am using an IAddInDesigner in my Com Add-in, I have
InitialLoadBehaviour set to None and I use IDTExtensibility2. I also
use Outlook Redemption.

I am using InstallShield (first time :-)), I have included all my
files including the dll which in the properties (registration) is set
to 'Extract Com Information'. I have set up all the relevant HKLM
registry keys (CommandLineSafe = 0, LoadBehavior = 3, Description and
FriendlyName), and built a single image with no errors.

When I install it and I look at the Registry HKEY_Users has nothing,
HKLM is as expected but HKCU still appears (albeit Load Behavior = 0).
I don't think that I am supposed to have any entries in HKCU so I am
doing something wrong! I hope that it is very obvious to you from the
information I've provided as I know that this should be so easy and I
am obviously not understanding properly how the designer and com
add-in are being registered.

Can you help please?

Kristy
 
The property setting to extract COM information is correct for the DLL for
the addin. I actually set all the properties such as LoadBehavior in the
designer, although they aren't used since I don't have the DLL set to
self-register. I then set up my registry keys in the Registry section of
InstallShield for either HKCU or HKLM and that's it.

Are you sure there isn't an existing HKCU key on the machine? At least in
the version of Visual Studio I use my dev machine usually has those keys
already since I've been debugging on that machine. On a clean machine the
HKCU key and values aren't created.
 
Hi Ken

When you say you don't have the dll set to self register what do you
mean? I know that when I'm debugging if I set the load beahvior to
Startup then obviously the dll is registered and HKCU enables the
addin to run and be debugged. I also ensure that these keys have been
completely deleted before I use the installer. I also am using the
registry keys in the Registry section of InstallShield to set up
HKLM... BTW I'm liking installshield very much too :-)

I thought to ensure that it didn't self register all I had to do was
set the Initial Load Behavior on the addin to None but this still
creates entries in HKCU? I've looked in properties etc for another
place to tell it not to self register but can't find any, how do you
get the dll not to self register?

If you do what I just described then there must be a dll somewhere
that I've forgotten about that is creating the entries, but I don't
think so, besides wouldn't I see it when Outlook started up :-(

Thanks for your patience

Kristy
 
If you look at the DLL file in InstallShield after it is put in your
installation folder and right-click on that DLL you can select Properties on
that context menu. In the second tab of the Properties you set the DLL to
self-register or to extract COM information. I set the DLL to have its COM
information extracted. Then I set up the registry entries I want in the
Registry section of InstallShield using the registry hive I want such as
HKLM or HKCU. I don't change any designer settings in the designer in the
project, I leave LoadBehavior there set to startup. That's all I do. Nothing
fancy.

If I'm using Redemption in a project I have the redistributable version of
Redemption and in the Redemption.DLL in InstallShield I set that to be
self-registering.
 
Hi Ken

I am very frustrated, from all of the many posts I've read it seems
that this should be an easy task but can I get it to work....NO!

Am I supposed to be doing something with the ALLUsers property in
installshield like I used to have to do in Orca using VSI? I read
something about setting up a customa action?

I have done exactly what you have suggested and still every time I
install the application the entries appear in HKCU... I give up!

Thanks for all your help :-)

K
 
I do nothing with All Users ever. I haven't used Orca in years so I can't
answer about how you set up registry keys in Orca. Custom actions I use only
in special circumstances, such as when I want to do something the installer
can't do on its own during installation. Then I write an EXE or a VBScript
program that I can call as a custom action during installation or
uninstalling an addin. An example might be to delete registry keys created
during runtime of the addin if I want them removed when the app is
uninstalled.

I would try using a simple, do nothing addin and trying an InstallShield
setup for that and only setting up the registry keys in the HKCU section or
HKLM section (not both) in InstallShield. Or an alternative might be to
download the ItemsCB COM addin sample from the Resources page at
www.microeye.com and wrap that in InstallShield and see what happens.
 
Hi

Sorry that I keep going on about this and that this post is so long...
I would really appreciate if you could read the below though and just
tell me if you see anything obvious. If not then any ideas on what I
should do... talk to InstallShield, rebuild my pc, jump off a bridge!

I downloaded a fresh copy of the itemscb example, I used the dll
provided from that download and opened a new Express project in
InstallShield. I then used the Project Assistant to set up the
installation (to try and minimise any user errors). These are the
things that I changed for my installation:

1. I filled in the Application Information
2. Then I unchecked anything before Office 2000 on the Installation
Requirements page.
3. I accepted all defaults for Installation Architecture
4. In the Installation Designer tab under General Information I
changed the INSTALLDIR to be [ProgramFilesFolder]ItemsCBTest, then in
the Application Files part of the Project Assistant I added the file
ItemsCB.dll.
5. I said "No" to looking for dependencies of the file, then I right
clicked ItemsCB.dll and ensured that it was set to 'Extract COM
Info'... I changed nothing else on the properties page.
6. I didn't set up any application shortcuts
7. In the Application Registry page I clicked 'Yes' to "configure
registry data that my application will install"... then under
HKLM\Software\Microsoft\Office\Outlook\Addins\ItemsCB.Connect I put
CommandLineSafe = 0, LoadBehavior = 3, FriendlyName = "ItemsCBTest"
and Description = "ItemsCBTest". I put no other entries in the
registry and double checked that nothing else had 'magically' been
filled in!

I changed nothing else before I built it. Then I installed it and the
registry keys appeared in both HKLM and HKCU :-(. When I uninstalled
it all entries were removed from both making me believe that it was
this installation that created the keys in the first place.

Does noone else get this? When I look up help in InstallShield it said
this about selecting "Extract Com Information"... "Select this option
if you want InstallShield to extract all COM registration data from
your file and register it on the system during setup. This is the
recommended way to register COM objects." Doesn't this mean that if I
have my Com Add-in set to load on Startup (which uses HKCU by default)
that it will take this info and register it? It sounds like that but
it doesn't happen to Ken with his installations????

I may just throw my pc out the window and get a new one... or even
better... be fired and be done with it!

Kristy
 
Just one more bit of info...

I just added some registry keys to HKLM that allow me to have the
option to register my addin in the HKLM hive. The keys are in
HKLM\Software\Microsoft\Shared Tools\AddinDesigner... I found the info
on how to do this in a previous post :-)

I then compiled my dll, went into installshield (chnaged nothing else)
rebuilt it and then loaded it and it worked... no entries in HKCU, and
only the ones I specified in the installer in HKLM.

I realise that I'll have to change my Com Add-in designer when I'm
ready to package it each time (I need to use HKCU for debugging) but
this is just one click!

Can anyone see any problems with doing it this way?

Cheers

Kristy
 
If that works for you great, use that method. An alternative would be to
discard the designer class module and use a standard class module. Just copy
all the code from the designer to the class module. That should also work.
 
Back
Top