SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Aug 2001
    Location
    A planet far, far away...
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Link DLL to Testcomplete

    I saw a post from 2007 but rather than reopen that I thought I'd create a new thread. I'm tinkering with writing functions in C# then linking them into TC.
    So I've written a very simple Hello world function in C# and am now trying to call it from within TC 8.
    The C# function:
    namespace HelloWorldDLL
    {
    public class HWorld
    {
    public string GetMsg()
    {
    return "Hello World";
    }
    }
    }

    The TC function:
    function testDLLLink()
    {
    // Define DLL
    var Def_DLL = DLL["DefineDLL"]("HelloWorldDLL");
    // Define GetMsg Procedure within DLL
    Def_DLL["DefineProc"]("GetMsg", VT_BSTR);
    // Load DLL
    var lib = DLL["Load"]("C:\\Temp\\HelloWorldDLL.dll")
    // Run function in DLL
    Log["Message"](lib["GetMsg"]);
    }

    I don't get an error msg, I just get a blank log entry. Any help would be very appreciated.
    J
    Jolum

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    A planet far, far away...
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Link DLL to Testcomplete

    Didn't notice that my C# function should have been static...doh!
    public static string GetMsg()
    {
    return "Hello World";
    }

    Also, if I add brackets to the function call i.e. lib["GetMsg"]() it returns "Object doesn't support this property or method"
    Jolum

  3. #3
    Member
    Join Date
    Aug 2001
    Location
    A planet far, far away...
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Link DLL to Testcomplete

    So, no one has any ideas?
    Jolum

  4. #4
    Member
    Join Date
    Aug 2001
    Location
    A planet far, far away...
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Link DLL to Testcomplete

    Never mind, as usual I worked it out on my own.
    I have to say, I don't often come to this site because almost every time I've posted a problem here I've ended up solving it myself. Sqaforums seems a nice site but tbh it's not very helpful.

    Don't bother flaming as I don't think I'll be coming back this way any time soon.
    Jolum

  5. #5
    Member
    Join Date
    Sep 2010
    Location
    TN, India
    Posts
    377
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Link DLL to Testcomplete

    Hi Jolum,
    I would appreciate if you post your working code here. This may helpful for others.

    Thanks...
    Thank/Like to help others if my input helped you !!!
    I am speaking for myself, not for my employer nor any one.
    Automation Ecstasy

  6. #6
    Junior Member
    Join Date
    Jun 2011
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Link DLL to Testcomplete

    We use the CLR bridge to link to the desired DLLs and then call them:

    var helloDll = dotNet.HelloWorldDLL.HWorld.zctor();
    var message = helloDll.GetMessage();

    See documentation: http://support.smartbear.com/viewarticle/11403/

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 11:49 PM.

Copyright BetaSoft Inc.