Forum Discussion

thilakasiri1978's avatar
thilakasiri1978
Occasional Contributor
11 years ago

DLL Unspecified error


I need to call some methods from a DLL provided by Dev team. I followed the instructions available in the TC training materials.  But I’m getting the ‘Unspecified error’ message when I run the code.


Code


‘’’’’’’’’’’’’’’’’’’’’’’’’’


  Set MyEnvironment = DLL.DefineEnvironment(True)


  Set MyStr = MyEnvironment.New("LPSTR", 128)


 


  b="1234567890123456"


  Set MyStr = DLL.New("LPSTR", 256)


  MyStr.Text = b


  Set Def_DLL = DLL.DefineDLL("AesEncryption.dll")


  Call Def_DLL.DefineProc ("CryptEncrypt", MyStr, MyStr)


  


 ‘Failing from below step


  Set Lib = DLL.Load("C:\QA Automation\FeeAlert\Automation\FunctionLibrary\AesEncryption.DLL")


  


 Results =  Lib.CryptDecrypt(MyStr)

'''''''''''''''''''''''''''''''''''''''



Appreciate your input.

  • thilakasiri1978's avatar
    thilakasiri1978
    Occasional Contributor
    This is resolved. File is a dotNET assemply and connect the file through CLR Bridge and call the methods.



        Set ObjLib2=dotNet.AesEncryption.AesEncryption.decrypt("YWIb9wDjlxTqg6pc+tVrwA==","f06812ed0aea4e56a31e7e6ad60e0d108f8f7ed232e742adaa5de20e7ea3b92f")

      Log.Message objlib2.ToString


      


      Set Obj2= dotNET.AesEncryption.AesEncryption.zctor("f06812ed0aea4e56a31e7e6ad60e0d108f8f7ed232e742adaa5de20e7ea3b92f")


      log.Message Obj2.encrypt("Thilakasiri")


     

  • thilakasiri1978's avatar
    thilakasiri1978
    Occasional Contributor
    I have done some minor changes and now I'm getting the 'Object doesn't support this property or method' error message.



    Code

    '''''''''''''''''''''''''''''


       Set MyEnvironment = DLL.DefineEnvironment(True)


    '   ''Create string variable


       Set MyStr = MyEnvironment.New("LPSTR", 128)


      b="1234567890123456"


       


      Set Def_DLL = DLL.DefineDLL("AesEncryption")


      Set Lib = DLL.Load("C:\QA Automation\FeeAlert\Automation\FunctionLibrary\AesEncryption.DLL")


       


       


      ' Registers the CryptDecrypt type in TestComplete


      Call Def_DLL.DefineProc ("CryptEncrypt", VT_LPSTR, VT_LPSTR)


        


      Set MyStr = DLL.New("LPSTR", 256)


      MyStr.Text = b


      

    ' -------------Error -----------------


     ddd=  Lib.CryptEncrypt(MyStr)





    '''''''''''''''''''''''''''