ActiveX plugin in MUSHClient

Posted by Sentinel on Tue 10 Sep 2002 11:02 AM — 10 posts, 28,560 views.

#0
Hi

I try to use an ActiveX plugin in USHClient, but it doesn't seeem to work.

I can use the plugin from Word just fine, but the same code from mushclient gives me an error.
The code is very simple:

Sub loadhud()
Dim HUD
Set HUD = CreateObject("XPERTHUD.XPERTHUD")
HUD.AboutBox
End Sub


MUSHClient produces the following error in the "HUD.AboutBox" line

Error number: -2147418113
Event: Execution of line 5 column 1
Description:
Called by: Immediate execution


but the same Method is callable from VBS from Word. Or from within a VB application


Any ideas ?


Sentinel
Australia Forum Administrator #1
Sounds like the CreateObject is failing. I think you can test for something like:


  if HUD is nothing then
    world.note "Could not create COM object"
    exit sub
  end if
 


Does the message occur during compilation, or execution? ie. do you have to type:

/loadhud

for the message to occur?

Does the "about" box appear?
#2
I have to call /loadhud to execute it, and the error comes during execution in the 'HUD.AboutBox' line before the Box is displayed. I now added the test code, but it seems I get a object back. at leat something != 'nothing'. for testing purposes I inserted an invalid Object name, and the script broke off right in the CreateObject line.



Peter
Australia Forum Administrator #3
It is quite difficult to say without seeing the COM object. I presume it is a small VB program? If you email it to me I'll try to work out what is going on (the project source, not the .exe).
#4
Well, I dont think it would help you.
a) its a C++ programm
b) after having problems with my code, I just tried the stuff with the basic, nothing-else ActiveX code, that Is autogenerated by VC++ 6.0. THen only thing I changed from Default is the name at which it registeres, and I also checked the 'invisible at runtime' button, but thats all.

Peter
Australia Forum Administrator #5
I understand C++, MUSHclient is written in it, after all.

If you don't want to send the whole source send a test program that reproduces the problem (eg. just has the about box).
#6
I mailed you the code.

Would e cool if you finf the time to check it.


Peter
Australia Forum Administrator #7
As I said in my email, I can't get it to work, however since I am not an expert in writing COM controls that can be called from script engines (or from anywhere for that matter), I can't say for sure where the problem is. It might be:

  • A problem in the control, that doesn't show up when it is called from Word
  • A problem in MUSHclient, however I note that I can call other COM objects (like ODBC database calls) OK
  • A problem in the scripting engine (eg. VBscript) because the control is really being called from VBscript


I don't know enough about COM and how it interacts with VBscript etc. to say for sure how to fix it.

I did a post a while back about how to make a VB project (COM object) that could be called from the script engine - that is the best I can do.
#8
I got it under control now.
I changed from an ActiveX control to a simple ATL Object, which now loads just fine in MUSHClient.

THna you for your time anyways


Peter
Australia Forum Administrator #9
Can you email it to me so I can post it as a "how to make a COM object" tutorial?

Preferably say what options you set and what changes you made to make it.

I tried using ATL without success.