Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VBS to DLL to QTP
04-07-2010, 06:27 PM
Post: #1
VBS to DLL to QTP

Could you please guide me on how to create DLL from a VBS file. And how such a DLL is associated to test so that I can call the functions in VBS.

Regards.
Find all posts by this user
Quote this message in a reply
04-07-2010, 09:18 PM
Post: #2
RE: VBS to DLL to QTP
(04-07-2010 06:27 PM)ssco77 Wrote:  Could you please guide me on how to create DLL from a VBS file. And how such a DLL is associated to test so that I can call the functions in VBS.

Regards.

Sorry you can't do it that way. You can create Classes in VBS then call the class.function, but they do not compile into DLLs. You need to use Visual Studio 6 or .NET to create dlls then install them as COM components in order to consume them in VBS/QTP. VS.NET does it pretty easily by selecting "Make Assembly COM visible" then registering. There are plenty of Google examples how to do this. You can even use the free Express editions of Visual studio to create and compile the dll files.

Easiest thing to do for QTP is create a VBS file then associate the file with your test/action in settings. You can still use classes.

Code:
'create class
Class TestMe
public sub HelloWorld()
   msgbox "Hello there"
end sub
End Class

'instantiate and consume
dim cltest: set cltest = New TestMe
cltest.HelloWorld

If you still wish to use DLLs then here is how. Create/compile dll using Visual studio. Register as COM component (Resasm.exe, I think...it's part of .NET utilities). Now QTP:
Code:
'if you use a namespace, don't forget to include it namspace.class
dim cltest:set cltest = CreateObject("cltestdll")
cltest.HelloWorld


I hope this helps.

Thanks
Find all posts by this user
Quote this message in a reply
01-28-2011, 01:05 PM
Post: #3
RE: VBS to DLL to QTP
i have created one dll in C++ in visual studio 2005 for some functionality. I have to use /link it in QTP scripts. How can i do this???

Shall i need to convert it to COM component and install them????
Find all posts by this user
Quote this message in a reply
01-30-2011, 09:28 AM
Post: #4
RE: VBS to DLL to QTP
You can create COM components in VBScript with Windows Scripting Components. It's just a little extra XML. Check them out: http://msdn.microsoft.com/en-us/library/...85%29.aspx

-Christian Desserich
Visit this user's website Find all posts by this user
Quote this message in a reply
02-16-2011, 03:46 AM
Post: #5
RE: VBS to DLL to QTP
You need to register the dll in the Global Assembly.

c:\windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe your.dll /codebase

Then you can consume it via VBscript.

Thanks
Find all posts by this user
Quote this message in a reply
12-16-2011, 01:21 PM
Post: #6
RE: VBS to DLL to QTP
we have created two scripts in vbscript for the ‘remote agent’ and ‘viewscript’. However, we need to place the dll/exe files in QC for custom test types. We are working on the conversion of these vbscript files to dll/exe. Is there any straight way to convert these in DLL or exe for QC 11.0
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Calling dll C# in VBScript nacchio 0 450 10-11-2011 07:32 PM
Last Post: nacchio
Exclamation how to Pass Optional Parameters in VBS? ShrikantBiradar3449 1 1,399 06-13-2011 03:12 AM
Last Post: Skepsis
  DP and called .vbs make for slow runtime wheelercha 0 456 01-05-2011 02:39 AM
Last Post: wheelercha
  QTP Actions in to vbs function anbarasu 2 1,144 04-05-2010 11:58 AM
Last Post: anbarasu
  set data from excel file in vbs devanggoel 0 810 03-08-2010 06:27 PM
Last Post: devanggoel

Forum Jump:


User(s) browsing this thread: 1 Guest(s)