My program is using the Skype4COM.dll (A wrapper for the Skype API).
I am using Delphi 2010 - is there a way to make sure that my program is ALWAYS using the Skype4COM.dll that I will ship it with? The thing is, there are different versions of Skype4COM, and if I register mine over someone elses, their app may not work anymore.
Usually I use RegSvr32 to register the DLL on peoples system, but I heard its possible to make it registration-free (in C#), so my question is: Can we do that in Delphi, too?
Thanks!
Before you even touch registration free com make sure your application works when the dll is registered. Once you are happy with this. It's time to try and get it to work registration free. First step is to unregister your dll. If you try and run your program now you should get ClassId not found.
First step is to create a manifest file for your application. A manifest file is an xml file which among other things can setup dependencies for your application. You may not know it, but since about Delphi 2007, if you have themes enabled, your application has had a manifest all along. Here it is from Delphi 2010 :
Now I'm not sure if you can add to this and you can only have one manifest file per application, I just usually replace it completely. Since I want themes enabled I start off with this file and add my dependency. In your case you need to add a dependency for the skype4com.dll Here's what I need to add :
Note I am actually adding a dependency to the Assembly Skye4COM.X and not the dll itself. Don't confuse the 2, although a dll can be an assembly an assembly is not necessarily 1 dll. This will become clear when we set up the assembly manifest/
Your manifest file now becomes :
Save this file with the same name as your executable, but with a .manifest suffix. For example SkypeClient.exe.manifest
The next step is to embed this manifest in your application. You'll need to create an resource file (rc file) with the following text :
Add this file to your application and build. If you still have themes enabled you will get a duplicate resource warning, just removed the {$R *.res} from your dpr file. You should also see this in the project file :
If you try and run your application now, you will get the following error message :
We now need to add a manifest for the assembly (Skype4COM.X). Create a file called Skype4COM.X.manifest. We need to describe the assembly in the manifest file :
Now place the Application the dll and the assembly manifest in the same folder and run!
If you get anymore errors you'll need to use SxSTrace to debug. This is available on Vista onwards. First start a trace :
run your program, and then press enter on the trace to finish it. Now parse the trace :
You should have a comprehensive log of the whole process in SxSTrace.txt