http://www.perlmonks.org?node_id=1089038

joago has asked for the wisdom of the Perl Monks concerning the following question:

hi --> I seek 4 days for my problem --> please help

I have CortalConsors.TradingAPI.dll and CortalConsors.TradingAPI.tlb and the doc for all objects inside.

I want made code in perl

I have example in .VB like

Imports System Imports CortalConsors.TradingAPI.DE Imports CortalConsors.TradingAPI.ValueObjects.DE Module TradingAPIClient Sub Main() Try ' Create the session facade Dim sf As New SessionFacade ' Login sf.LoginWithAddOnName("OrderAddVb") .......

I have also example in C++.COM , C++.NET and c# .

If I write:

my $sf=Win32::OLE->new('CortalConsors.TradingAPI.DE.SessionFacade'); print $!; print Win32::OLE->LastError();

then I have: Win32::OLE(0.1711) error 0x80040154: "Klasse nicht registriert"

If I do : regsvr32 CortalConsors.TradingAPI.dll

then I have : Das Modul CortalConsors.TradingAPI.dll wurde geladen aber der dllRegister-Server Eingangspunkt wurde nicht gefunden

In which manner can I use the .dll in perl ?????

--> I try WIN32::OLE and WIN32::API and have no success !!!!!

In OLE/COM Object Explorer I see:

Name: CortalConsors.TradingAPI.DE.SessionFacade GUID: {C30D1F5C-0F97-4A05-BACA-885D135975B8} ---------------------------------------------------------------------- +---------- CLSID {C30D1F5C-0F97-4A05-BACA-885D135975B8} = Implemented Categories = {62C8FE65-4EBB-45E7-B440-6E39B2CDBF29} = InprocServer32 = InprocServer32[RuntimeVersion] = InprocServer32[ThreadingModel] = InprocServer32[CodeBase] = InprocServer32[Assembly] = InprocServer32[Class] = 1.1.1.0 = 1.1.1.0[Assembly] = 1.1.1.0[RuntimeVersion] = 1.1.1.0[CodeBase] = 1.1.1.0[Class] = ProgId =
Thank you (sorry for my english)

Replies are listed 'Best First'.
Re: DLL or VB to Perl
by silent11 (Vicar) on Jun 06, 2014 at 15:41 UTC
    If you have the full VB code, you can run it through ActiveState's VB to Perl converter, which is included in the Perl Dev Kit, which I believe you can get a 30 day free demo.

      I have not vbs source only vb ...

      in SDK is vbs and not vb converter this giv me:
      Errors in input. Syntax error at or near line 5, column 1: Module TradingAPIClient ^^^^^^
Re: DLL or VB to Perl
by xiaoyafeng (Deacon) on Jun 11, 2014 at 02:45 UTC

    Your English is as bad as me, so i don't be sure if my answer is for you.;)

    first you need use enumobject to check if com library installed correctly
    $Count = Win32::OLE->EnumAllObjects(sub { my $Object = shift; my $Class = Win32::OLE->QueryObjectType($Object); printf "# Object=%s Class=%s\n", $Object, $Class; });
    if the library name you want to use does show in above list, you must recheck your perlcode.

    in the other hand, you can use ole_viewer, and other M$ tools to export function declaration, and use it in XS/Inline C. I've tried but it's really tedious work.





    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      I have made VBS:

      Set objLib = CreateObject("CortalConsors.TradingAPI.VersionInfo") name = objLib.GetAssemblyFullname() MsgBox name

      The VBScript Converter translate this:

      #!perl use Win32; use Win32::OLE; $objLib = Win32::OLE->new('CortalConsors.TradingAPI.VersionInfo'); #### Error: Can't resolve progID CortalConsors.TradingAPI.VersionInfo $name = $objLib->GetAssemblyFullname(); Win32::MsgBox($name);

      The VBScript work fine --> The perl not !!

      I have install "SystemScripter" --> This tell me (If I want load the

      COM-Object 'CortalConsors.TradingAPI.VersionInfo'):"Typelibrary Missing"

      and can not resolve the details from COM.

      In "SystemScripter" can I give the path of TLB by hand and it's work

      Both (DLL and TLB) are in registry --> maybe not right !?

      What can I do in perl ???

        In "SystemScripter" can I give the path of TLB by hand and it's work...

        What does that mean? What does that mean in terms of API calls? Why don't you try a "class id" instead?