Wednesday, August 21, 2013

Calling DLL file using DotNetFactory

Calling DLL file using DotNetFactory

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")

No comments: