|
-
February 3rd, 2011, 12:51 PM
#1
DLL Registration Issue
I have designed a C# program in VS2008 (.NET 3.5). the purpose of the program is to use my brokerage's COM dll components to connect to them and pull quote history automatically every so often for analysis in my other program which emails me updates and possible trade decisions.
my program works just fine but the issue is knowing when to register the DLL's or not. What I mean is that if the user has the brokerage's software already installed on the machine then there is no need to register them. in fact, doing so will work temporarily but if my program is uninstalled them the brokerage software doesn't work. i had to uninstall, reinstall, and reboot before the brokerage software would work after registering "my" DLL's.
i am using a batch file script to execute regsvr32 commands on the DLL's in my program's installation directory and what i believe what is happening is that there is only one entry in the registry for a given CLSID and therefor, when my program is installed and runs for the first time it registers the ones in my directory. then if i uninstall mine, the entries are gone or invalid and the brokerage software cannot load the objects because the CLSID entry in the registry is either missing or points to a file that no longer exists.
how would i go about ensuring that my program does not screw up the brokerage software while still working on machines that don't have it installed? is there a way to use the COM DLL's in my directory WITHOUT having them registered with the system? that would solve the problem. if not, how would i go about this? would i have to write code to check the registry for valid entries for each CLSID and if it does not exist, then register that DLL?
Thanks in advance,
-Ryan
-
February 3rd, 2011, 07:20 PM
#2
Re: DLL Registration Issue
You do it by using a proper install program that will correctly register the DLLs.
When multiple apps try to register the same DLL, the registry is updated to reflect that the DLL is now "shared" ... so if one app then tries to uninstall, shared DLLs should get left alone until the "used by" count returns back to 0. Because of the method you are using, this "app count" isn't being updated.
-tg
-
February 4th, 2011, 07:39 PM
#3
Re: DLL Registration Issue
thanks for the advice. that's a good way to do it. the problem is that when i try to use the self registration feature of the windows installer setup projects in Visual Studio, VS2008 crashes every time when i try to build the solution.
i can't seem to figure out how to fix it so i had to come up with a workaround. but that was the first thing i had tried. i wrote some code last night and tested it today on 3 machines, and it appears to work.
when the program starts up, it checks to see if the needed COM dll's are registered with the system by reading the registry entries in classes root \ CLSID. if the entry is there and the file it references actually exists (i.e. not a leftover registry value that points to a missing file), then do nothing - otherwise, register my copies included with the installer.
tried it on one machine that had the brokerage software, and 2 that did not. all 3 seem to function fine.
from what i read elsewhere you apparently can do a "registration free COM" usage by using a manifests file. but i am not familiar with that and judging by the page i was reading, that technique is a little bit above my skill level at this time.
i also noticed that with the more recent versions of my brokerage software they are using the manifest method AND registering the COM DLL's for people like me who want to use the SDK package.
when i "broke" the software the other day it was using a slightly older version which did not use the manifest method. my father was using the latest version and he told me the program i sent him did not break his. i couldn't figure out why...but now i know.
thanks again,
-Ryan
-
February 4th, 2011, 11:12 PM
#4
Re: DLL Registration Issue
VS has a setup tool, that can deploy to x86 or x64 bit OS's
Once you get the basics down, with a simple project, and figure out HOW to do it, it will work in 99% of the cases.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|