Site Loader
Auckland, New Zealand
Last post we saw how to call DLL file using CreateObject, well we can also use another way to call the DLL file methods in QTP using DotNetFactory. In this post we are going to see how to call DLL file in QTP instead of registering it via COM component as we did in the previous post. We need to use another way to register DLL by using GACUTIL. You can find the information on installing the DLL using GACUTIL from here. I have used the same code as used in the previous post to create the Class library files which you can find from here. Now the code for QTP looks something like this.
Set DotNetObject = DotNetFactory.CreateInstance("ForQTPLibs.Libs","C:\\ForQTPLibs\\bin\\Debug\ForQTPLibs.dll")
msgbox(DotNetObject.AddIntegers(20,30))
msgbox(DotNetObject.Today())
That’s it !!!

Post Author: Karthik kk

Leave a Reply

Your email address will not be published. Required fields are marked *