Invalid Number of Parameters

105 views
Skip to first unread message

Les Stroud

unread,
Sep 19, 2012, 7:59:35 PM9/19/12
to ff-acti...@googlegroups.com
I am having an issue with calling functions with parameters.  Parameter-less calls works fine.  

It errors out in scriptable.h in InvokeControl (line 187).  When I set a breakpoint there, the hr value is “Invalid number of parameters”.  

When I use the object browser to inspect the contained ocx, the method takes a single boolean parameter.  I’ve also confirmed that variants is correctly converting the boolean value and that simple argument is being passed in.  

Any idea how I can figure out what is going on here?

Backgroud
 - compiled latest ff-activex-host from hg
 - compiled against latest firefox code release
 - running in lastest firefox (15)
 - using visual studio 2010
 - the underlyling ocx is a 3rd party control for which i don’t have source.  however, these methods work when the control is loaded directly in ie.
 - npffax.dll is installed in the firefox install directory under plugins
 - the plugin is loaded and i see the logging output from the wiki article
 - i don’t receive the onreadystatechange event

Log Output
AxHost.verifyClsID: verified successfully
AxHost.setClsID: CLSID {486D2165-6DF1-11D2-AC92-00105A1054F5} set
AxHost.CreateControl: control created successfully
AxHost.AddEventHandler: GetIDsOfNames failed to resolve event name

The event handler error is from me trying to register for "event_OnReadyStateChange=“someMethod” “.  Apparently that event isn’t there?


I appreciate any help you can provide,

LES

Leeor Aharon

unread,
Sep 20, 2012, 4:07:42 AM9/20/12
to ff-acti...@googlegroups.com
Hi Les,

IE can add functionality to ActiveX controls which miss certain useful functions. The ready state change notification is one of them. This plugin does not fully imitate IE, and therefore such differences exist. This can explain the error you're getting when trying to bind a handler for the OnReadyStateChange event. You can verify this by opening the .ocx file in OleView (I think that's the name of the tool from VS tools).

You also describe another error - invalid number of parameters - but I don't see any logs related to that error. Can you send the logs and the method signatures as shown in OleView?

Thanks,
Leeor.

--
You received this message because you are subscribed to the Google Groups "ff-activex-host" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ff-activex-host/-/sCDGM_rslM0J.
To post to this group, send email to ff-acti...@googlegroups.com.
To unsubscribe from this group, send email to ff-activex-ho...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ff-activex-host?hl=en.

Les Stroud

unread,
Sep 20, 2012, 11:40:46 AM9/20/12
to ff-acti...@googlegroups.com
Yeah, there isn't any log output related to the error (which is the more important one). 

From javascript, I set a number of properties and call a number of methods on the control.  The first call is to an IsReady method, which works and indicates that the control is ready.  Subsequently, I set some values, control.SomeProperty = 4.  That seems to work as well.  However, I have problems calling any method with a parameter. 

Specifically, when I call a method like control.ShowToolBar(true) (or any of a number of similar methods) and I get "Error: Error calling method on NPObject!".  When I use the debugger and break at  scriptable:187 (InvokeControl method): 

HRESULT hr = disp->Invoke(id, IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, NULL, NULL);

return (SUCCEEDED(hr)) ? true : false;


the return value (hr) from the invocation is "Invalid number of parameters" - which gets interpreted as false. 

I have attached a screenshot of the object viewer view of the method i am calling for reference.



Here's the method in the ole type viewer:


Note that I had to open it with the 32 bit type viewer.  The 64-bit viewer was unable to read it.

Any thoughts on where to go from here?

Thanx,
LES
Message has been deleted

Les Stroud

unread,
Sep 20, 2012, 3:23:30 PM9/20/12
to ff-acti...@googlegroups.com
Adding the screenshots that didn't show on the previous reply...


Babar Shafiq

unread,
Sep 20, 2012, 4:48:24 PM9/20/12
to ff-acti...@googlegroups.com

Did you tried 0,1 instead of true,false ?

Les Stroud

unread,
Sep 20, 2012, 5:04:06 PM9/20/12
to ff-acti...@googlegroups.com, bsh...@silicontechnix.com
Yeah, no luck...

Babar Shafiq

unread,
Sep 20, 2012, 5:11:48 PM9/20/12
to Les Stroud, ff-acti...@googlegroups.com

Your function might have something to do with Gui ! active/current window ? tried passing hwnd?

Message has been deleted

Les Stroud

unread,
Sep 20, 2012, 5:21:52 PM9/20/12
to ff-acti...@googlegroups.com, Les Stroud, bsh...@silicontechnix.com


On Thursday, September 20, 2012 5:11:50 PM UTC-4, babarnazmi wrote:

Your function might have something to do with Gui ! active/current window ? tried passing hwnd?


How would I pass an hwnd from javascript? 

Les Stroud

unread,
Sep 20, 2012, 5:26:18 PM9/20/12
to ff-acti...@googlegroups.com, Les Stroud, bsh...@silicontechnix.com
I attached some further screenshots so you guys could see what I'm seeing....

It looks like values are being converted.  The only thing that I see is the expected input is VARIANT_BOOL and the host is passing BOOL.  Could COM not be recognizing the type and assuming that there is not a correctly typed parameter?
Screen Shot 2012-09-20 at 5.16.56 PM.png
Screen Shot 2012-09-20 at 5.17.27 PM.png
Screen Shot 2012-09-20 at 5.18.12 PM.png

Babar Shafiq

unread,
Sep 20, 2012, 5:32:35 PM9/20/12
to Les Stroud, ff-acti...@googlegroups.com

Have you tried hard coding it inside ActiveX control ?

like:-

me.hwnd show //in your function

On 2012-09-21 02:21, Les Stroud wrote:

Les Stroud

unread,
Sep 20, 2012, 5:43:41 PM9/20/12
to ff-acti...@googlegroups.com, Les Stroud, bsh...@silicontechnix.com
I don't have access to the contol's source.  It's a third party piece of software. :(

Les Stroud

unread,
Sep 20, 2012, 6:02:03 PM9/20/12
to ff-acti...@googlegroups.com
Maybe these screenshots will help:

I don't know if it is the VS2010 gui showing the type of the rgvarg value as BOOL or not, but BOOL is not on the VARIANTARG struct.  Has anyone had any methods with boolean values work?

Thanx,
LES
Screen Shot 2012-09-20 at 1.54.15 PM.png
Screen Shot 2012-09-20 at 5.46.04 PM.png

Les Stroud

unread,
Sep 24, 2012, 2:00:12 PM9/24/12
to ff-acti...@googlegroups.com
Ok, I've tried embedding the same control in another visual c++ project just to try invoking the method.  I get a .net-ish error (System.Reflection.TargetParameterCountException) that sounds similar to what I found in the plugin.  So, this same method works when I invoke it in IE (via the native activex host) and the ole inspector indicates that it is a single variant_bool argument yet i am getting a consistent error that it wants more parameters.  Is there a way for me to introspect the invocation to see what it is expecting?

Unfortunately, it has been years since I've done Windows programming.  So, any help on how to figure this out would be appreciated.

Thanx,
LES


On Thursday, September 20, 2012 4:07:45 AM UTC-4, Leeor Aharon wrote:

Leeor Aharon

unread,
Sep 24, 2012, 4:31:01 PM9/24/12
to ff-acti...@googlegroups.com
Hi Les,

I'm currently on vacation so my availability is reduced.

As I mentioned earlier, there are several differences between IE's ActiveX hosting framework and this plugin. Specifically, this is not the first time I'm hearing about issues with .NET controls.

I'm not a Windows expert either myself, but can a tool such as the .NET reflector (http://www.reflector.net/) help you look into the method you are trying to invoke?

Leeor.

To view this discussion on the web visit https://groups.google.com/d/msg/ff-activex-host/-/3jYrJJBRggMJ.

Eric Johnson

unread,
Sep 24, 2012, 4:52:45 PM9/24/12
to ff-acti...@googlegroups.com
I just wanted to say MUCH THANKS Leeor for your gracious and fast responses to this group. I have been following for quite some time, and you never fail to help everyone out.

eric johnson
tournamentgames.com

Les Stroud

unread,
Sep 24, 2012, 5:19:58 PM9/24/12
to ff-acti...@googlegroups.com
Thanks for the response.  

If you are on vacation, it can wait til you get back.  However, if you have time, when you do get back, any help you can provide would be appreciated.

I'll give reflector a try.  However, to clear up any confusion, the control is not a .NET control.  It's MFC based (though I don't have the code to verify that).  I just happened to try hosting it in an test visual c++ app that used .NET as the target.  

I'm starting to wonder if it is related to building ff-activex-host with VS2010 (they removed a lot of the mfc stuff and inserted some .net stuff).  It's hard to imagine, but I wonder if the reflection mechanisms have changed such that it doesn't recognize these variant types anymore.  So, I am gonna try to get VS2008 and rebuild ff-activex-host with it and see if I have any better luck.  

I'll let you know....have a great vacation.

Thanx,
LES

Leeor Aharon

unread,
Oct 10, 2012, 4:09:48 AM10/10/12
to ff-acti...@googlegroups.com
Hi Les,

Have you had any success trying to solve the parameter issue since your last post?

Leeor.
Reply all
Reply to author
Forward
0 new messages