views:

1339

answers:

7

I have a VB6 application that needs to be installed on Windows Vista as a Standard User. Using Visual Studio 2005 I have created a setup project that will place the application in a standard user safe place or folder. I also have a dll that I want to install and register to the users application data folder. Once my windows installer is created in VS'05 I flipped the word count properties' 3rd bit using msiinfo.exe so that Vista will not prompt Admin credentials when it runs the msi. The application installs without any problems until it tries to register the dll to the users application data folder. When it reaches that point it throws an error stating that it cannot register the type library for the dll. It appears the installer does not have the authority to register a dll to the users folder. Is this correct? My understanding was that Vista only complained about standard users updating or changing items that affected all users of a machine. Any ideas? Thoughts? Suggestions?

A: 

Registering a DLL does impact all users (DLLs are registered globally) and therefore requires Admin permissions. There is no way around that.

The solution for newer programming environments is that the DLL doesn't need to be registered to be used. However, since vb6 relies on COM you're probably out of luck.

Joel Coehoorn
not quite out of luck... in fact that's what reg free COM is for... as in other answers
MarkJ
As documented in this MSDN entry, COM looks at HKEY_Current_User\Software\Classes before looking at the computer wide HKEY_Classes_Root. http://msdn.microsoft.com/en-us/library/ms693350%28VS.85%29.aspx
dthrasher
+1  A: 

Generally I agree to what Joel Coehoorn says in his answer.

However, knowing how the registry works in this regard, I can make the suggestion that you try to manually register your DLL to HKEY_CURRENT_USER\SOFTWARE\Classes, basically repeating what regsvr32.exe would do to HKEY_LOCAL_MACHINE\SOFTWARE\Classes.

It's a bit of a hack, and maybe it won't work, but you can try it.

Tomalak
In regards to your comment about registering the dll to the HKLU rather than the HKLM, I have tried that. Using orca to edit the msi, I have set the registry entries root column to 1. When i do this though, the msi fails the ice validation check. I guess I will give the xml manifest a try...
Strongly advise using reg free COM rather than trying this, which sounds pretty iffy IMHO
MarkJ
As I said - it's a bit of a hack, but worth a try.
Tomalak
Actually I'm going to back down and +1 this now! I've just found a reference in MSDN that says you can register COM servers in HKEY_CURRENT_USERS. That's a bit more authorative than the VBForums post. http://msdn.microsoft.com/en-us/library/ms693350.aspx
MarkJ
BTW I believe this was new in Windows 2000. I pity anyone to whom that's relevant. :)
MarkJ
@MarkJ: Thanks for fetching the link. (And for coming back to this after such a long time.)
Tomalak
+4  A: 

Instead of registering your DLL files directly, you can use RegFree COM.

This involves creating an XML manifest file for your app, so Windows will look for your DLL files in the application folder, instead of using the system registry to find them.

This means your app will run properly without your installer having to register DLLs.

These links have more info:

http://msdn.microsoft.com/en-us/magazine/cc188708.aspx

http://www.devx.com/vb/Article/32888/1954

You can use the free Make My Manifest software to create the manifest files you need:

http://mmm4vb6.atom5.com/

Alex Warren
+1 Can I suggest U edit UR answer to also mention Make My Manifest as suggested by OneNerd http://mmm4vb6.atom5.com/
MarkJ
The msdn article about RegFree Com says this: "In fact, the original intent of Reg-Free COM was to enable existing native applications, such as ones written in Visual Basic 6.0, C++, or some combination of languages." I have not found anything on VB6 RegFree com...any links?
Make My Manifest works with VB6 - see OneNerd's answer
MarkJ
+4  A: 

Steve

My suggestion is, if you are able, to use regfree com / manifest files instead of registering the ocx/dll files, which as you mention is a real chore under a basic user account.

There is an excellent free app you can use to build the manifest for you as well here: http://mmm4vb6.atom5.com/

We have been using this for a few years now, with no issues.

OneNerd
Hi, Steve has been having some problems with MMM, which he's documented in another answer. Maybe if you have time you could stop by and see whether you have any insight based on your experience with it, I think he'd be grateful. Cheers.
MarkJ
A: 
  • Registry-free COM: MakeMyManifest is well spoken of. It is an automatic tool for creating manifests for VB6 projects: I haven't tried it myself.
  • DirectCOM is an alternative to registry-free COM. It also has fans, again I haven't tried it.

There is a semi-automatic technique for creating manifests for registry-free COM. You can create the manifests with Visual Studio 2008 (you can use a free version like Visual Basic Express Edition). Then make a couple of edits by hand to make the manifests suitable for use from VB6. See this section of this MSDN article for step-by-step instructions - ignore the rest of the article which is about ClickOnce.

MarkJ
A: 

THIS IS NOT ANSWER: I just wanted the ability to type more than 300 characters about my original question and I did not see that option...hope I am not breaking the "rules."

I was able to download MMM. Once I did, I ran MMM.exe and opened my myApp.vbp. I ran through all of the steps and it created a new folder named MMMPack in my application folder. I then attempted to run the myApp.exe and the application starts but at some point during the load process, I receive a runtime error '339': Component 'vbalTbar.ocx' or one of its dependencies not correctly registered: a file is missing or invalid. I checked the MMMPack folder and verified that vbalTbar.ocx is in fact in the folder along with the manifest. Other files in the folder include: COMDLG32.ocx, MSCOMCTL.ocx, Msmask32.ocx, vbalTbar.ocx, xarraydb.ocx, and other in house written and 3rd party dll's. With that result, I decided to create a dummy vb6 project and only include one in house dll. I ran the vbp through MMM and it created a MMMpack folder for that project. The resulting files were/are the project executable, manifest, and included dll. I tested this exe on my machine and it ran successfully. I then copied the folder to a clean Vista machine and ran the application. When the test application hit the included dll's code, it threw me a runtime error '429': ActiveX component cannot create object.

Any thoughts or suggestions on this?

Thanks in advance,

Steve

MarkJ
MMM has to obtain dependency information from somewhere. It begins by looking at the VPB file. From there it looks for DEP files (which people often forget they are responsible for creating and deploying to dev machines). Beyond that any further dependencies must be added by hand.
Bob
does vbalTbar.ocx have a dependancy? My guess would be that ocx required another file to operate properly. Is it a 3rd-party component? If so, perhaps their documentation can help steer you towards the correct dependency files.
OneNerd
also, look in the mainfest file itself -- for the vbalTbar section, is there nothing there (is it blank)?
OneNerd
When I created my manifest for myApp.vbp, the dependencies screen in MMM threw me a warning stating that I was including "Standard or unregiestered Dlls/OCXs" once I removed those files, my ran fine. Next question to OneNerd: how do you deploy your app once you create a manifest? with VS?
You could do an x-copy distribution (zip up the files into a self-extracting exe for example) if you want, or, use something like innosetup.
OneNerd
With a reg-free COM manifest in place you can use VSI 1.1 and a post-build tweak to create per-user packages that an SU can successfully install for himself. The same should be true using a later VS version's setup project type. In either case you flip that Word Count bit.Just be sure to suppress self-registration of the COM libraries involved from within the VS setup project.As of Win7 there is a new convention for these installs. They go under [LocalAppData]\Programs which also works in Vista and XP.
Bob
if vbalTbar.ocx is from vbAccelerator site then it is dependent on ssubtmr.dll, msxml3.dll and as VB5 control vb5 runtime dlls msvbvm50.dll. Also vb6 runtime is installed on Vista but VB5 is not.
Goran Peroš
A: 

Unattended Make My Manifest is a remake of MMM that can be used to generate manifests in automated builds. It uses a script file to add depended COM components.

wqw