Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / January 2004



Tip: Looking for answers? Try searching our database.

Warning: automation argument coercion failed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matheus Peschke - 23 Jan 2004 03:33 GMT
Hi,

I'm trying to use a VB ActiveX DLL as a server in my VC++6.0 SP5 client app.
This server connects to an ADO database and is a 'wrapper' for the
ADODB.Connection events.  I.E., it fires custom events when its internal
Connection member (Private WithEvents) fires an event.

I've set the connection point, constructed the sink class and set all the
sink events in the BEGIN_DISPATCH_MACRO, in the client.

The server works well, performs methods, fires custom events and returns
properties as expected, in the sink class.  The sink class correctly
declares all the VTS_ parameters. Problem is, the events fired inside the
ADODB connection object generate the following automation error:

Warning: automation argument coercion failed

Strange, because the simple events (the ones not fired from inside the ADODB
events, but from the server methods, for example) have the same argument
types (hence, there's no undeclared interfaces), and they are perfectly
captured by the sink class.
It's not because of ADODB reference in my client, because it is declared in
the #import directive in the client.

I am very suspicious about the MIDL compiler.  First, when it tries to
compile the .IDL file generated from the OLE/COM Object Viewer, there is a
couple of shame errors, like the absence of correctly nested interfaces. And
more, the syntax for the [custom] attribute is wrong (see SDK
ms-help://MS.PSDK.1033/midl/midl/custom.htm).  I've corrected them all, but
is it normal so much manual edit in the .idl file?

Any light for me?  Anyone here ever tried to use such type of VB ActiveX -
ADO enabled in a VC++ client?

Ps. The VB server works perfectly with a VB client.

TIA!!!
Matheus Peschke - 28 Jan 2004 22:05 GMT
Ok, my fault.  After a carefully watch over SDK (MIDL, COM and
IConnectionPoint), I realized I was supplying the wrong event PID from the
IDL file, in the DISP_FUNCTION_ID macro.

Everything works fine, but now I'm trying to realize how to access the class
instance passed by the event parameter,
in the form of a VARIANT:

void MyEventSink::SomeEvent(const VARIANT* param) // Actually, param is an
ADODB.Error class.

The parameter param->vt == VT_DISPATCH, but while I'm trying to access a
method or property
through param->pdispVal->Invoke() or param->pdispVal->GetIDOfName(), I get
an access violation...
any ideas?

> Hi,
>
[quoted text clipped - 33 lines]
>
> TIA!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.