AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
I have an Visual Studio 2005 application written in Visual Basic that I want to connect with to a COM-DLL, if it is registered on the users machine. If not, some functionality of the application will simply not be available. Is there any way to do this and still reference the DLL from Visual Studio, or do I have to declare all references to the DLL as Object and then use CreateObject to instansiate the objects?
Regards,
/Johan
Answer The easiest way to do it is to leave the references while you are doing development and debugging on your development machine. And just before deployment you can remove the references of from your project. And replace the variable declarators like following:
Original:
Dim objCOM as New ActiveXClass
Dim objCOM2 as ActiveXClass2
Change To:
Dim objCOM as object 'as New ActiveXClass
Dim objCOM2 as object 'as New ActiveXClass2
objCom = createobject("ActiveXClass") 'Remember to use full namespace You can also use Getobject if you dont want create a new instance.
if objCOM is nothing then
'Disable functionality
else
'Enable functionality
end if