Jump to content

Can AutoIt not handle this COM dll?


Recommended Posts

Well I have been trying to access an opensource dll for opentick, which is compiled in several different formats. I started out trying to use dllcalls, because all the apis are opensource, but I had no luck so I am now trying to get the COM dll to work.

I registered the dll

regsvr32 COTFeed.dll

Then when I look in OLE/COM Object Viewer it is not under the Object Class, but it is under Type Libraries.

Does it have to be under both? If so is there a way to add under object class?

Here is a working VC# sample program

using System;
using COTFeedLib;

namespace ConsoleApplication1
{
  /// <summary>
  /// Summary description for Class1.
  /// </summary>
  class Test1
  {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [MTAThread]
    static void Main(string[] args)
    {
      
      OTClientHandler handler = new OTClientHandler();    
      COTDataEntityClass dataEntity = new COTFeedLib.COTDataEntityClass();
      COTClient  OTClient = new COTFeedLib.COTClientClass();
      OTClient.setOTMessageHandler1(handler);

      string host = "feed1.opentick.com";
      int port = 10010;

      string user = "";
      string pwd = "";

      while (user == "")
      {
          Console.Write("Please, enter your login: ");
          user = Console.ReadLine();
      }

      Console.Write("Please, enter your password: ");
      pwd = Console.ReadLine();


      OTClient.addHost(host, port);
      OTClient.login(user, pwd);             
      Console.ReadLine();

Here is the starting of my code based on the sample I used COTFeedLib.COTClientClass, and also tried several versions of that

$obj = ObjCreate("COTFeedLib.COTClientClass");create the object 
$ret = $obj.addHost("feed1.opentick.com", 10010)
msgbox (0,"From Call",$ret)

Using _ComErrFunc I get this:

AutoIT COM Error Occured!
    Error Number: 800401F3
    Line Number: 50
    Source: 
    Last Dll Error: 0
    Help File: 
    Description: 
    WinDescription: Invalid class string

Line 50 is $obj = ObjCreate("COTFeedLib.COTClientClass");

I have also posted some information about trying to access these dll in this post

http://www.autoitscript.com/forum/index.php?showtopic=47247

Any help is greatly appreciated

Link to comment
Share on other sites

Please look at the helpfile docs under Obj/Com reference to see the requirements for ObjCreate.

You might also want to look at the Harvest Enum constants code in my sig to see if you got the class string correct since you say you see the typlib.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Please look at the helpfile docs under Obj/Com reference to see the requirements for ObjCreate.

You might also want to look at the Harvest Enum constants code in my sig to see if you got the class string correct since you say you see the typlib.

Dale

Dale,

Thanks for responding, but I gave up on COM and actually got dllcall to work. I have read the Obj/com helpfile multiple times, but was never able to figure out why it wouldn't work. I am pretty sure that the class string is right because the VC# example I gave works great which uses: COTFeedLib.COTClientClass

I liked the possiblities your script would add except it didn't work for me. I get two errors:

$sApp already declared as parameter

$bShow already declared as parameter

So when I fix your script it does great for excel, but of course not for the dll I am trying to access because it doesn't think its a object

From what I know dllcall is better than COM anyways, is it not?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...