Board index » cppbuilder » Errors when instantiating an Active Form from an ActiveX Library

Errors when instantiating an Active Form from an ActiveX Library

Hi,
I'm trying to take advantage of Builders strong GUI features and use it to
enhance my already-developed vc app.  I've created an ActiveX library and
added an ActiveForm.  This form is very simple, containing 3 buttons.  Once
a button is clicked, ShowModal returns a value.  However, when I try and
instantiate this COM object, I get an assert error "Call through deleted
thunk".  I suspect that I've created a COM object with an interface that
erroneously maps exposed calls to non-existent implementations.  But, I've
only used the wizards so I don't know how this may have happened.  If anyone
has any ideas how this came to be I'd appreciate help.  Thanks.

 -- Micah

 

Re:Errors when instantiating an Active Form from an ActiveX Library


Quote
In article <3c89765a$1_1@dnews>, Micah Mason <mma...@spsmail.com> wrote:
>Hi,
>I'm trying to take advantage of Builders strong GUI features and use it to
>enhance my already-developed vc app.  I've created an ActiveX library and
>added an ActiveForm.  This form is very simple, containing 3 buttons.  Once
>a button is clicked, ShowModal returns a value.  However, when I try and
>instantiate this COM object, I get an assert error "Call through deleted
>thunk".  I suspect that I've created a COM object with an interface that
>erroneously maps exposed calls to non-existent implementations.  But, I've
>only used the wizards so I don't know how this may have happened.  If anyone
>has any ideas how this came to be I'd appreciate help.  Thanks.

How are you trying to instantiate the object?

Re:Errors when instantiating an Active Form from an ActiveX Library


My first attempts were to register the object and then add it to my VC app
by selecting it from a list of registered controls.  I then tried adding the
object directly into the project by importing the OCX file - VC gave me this
error:
"The ActiveX control is not registered properly, or its type library version
number is incorrect.  Try registering the control by removing it and
importing it in the Component Gallery." I tried this as well - no luck.
Finally, I tried instantiating the control in the VC ActiveX Control Test
Container, and it crashed immediately aftewards.

Thanks.

Quote
<aphr...@minasanor.borland.com> wrote in message

news:a6j3td$pl6$1@minasanor.borland.com...
Quote
> In article <3c89765a$1_1@dnews>, Micah Mason <mma...@spsmail.com> wrote:
> >Hi,
> >I'm trying to take advantage of Builders strong GUI features and use it
to
> >enhance my already-developed vc app.  I've created an ActiveX library and
> >added an ActiveForm.  This form is very simple, containing 3 buttons.
Once
> >a button is clicked, ShowModal returns a value.  However, when I try and
> >instantiate this COM object, I get an assert error "Call through deleted
> >thunk".  I suspect that I've created a COM object with an interface that
> >erroneously maps exposed calls to non-existent implementations.  But,
I've
> >only used the wizards so I don't know how this may have happened.  If
anyone
> >has any ideas how this came to be I'd appreciate help.  Thanks.

> How are you trying to instantiate the object?

Re:Errors when instantiating an Active Form from an ActiveX Library


Quote
In article <3c8d3ce3$1_2@dnews>, Micah Mason <mma...@spsmail.com> wrote:
>My first attempts were to register the object and then add it to my VC app
>by selecting it from a list of registered controls.  I then tried adding the
>object directly into the project by importing the OCX file - VC gave me this
>error:

ahhh. it sounds like registration failed. did you try registering
with tregsvr?

Quote
>Finally, I tried instantiating the control in the VC ActiveX Control Test
>Container, and it crashed immediately aftewards.

I've never heard of that behavior before. *puzzled look*

Re:Errors when instantiating an Active Form from an ActiveX Library


I previously used the Run-Register ActiveX Server command, and that said
success but then gave me the results I mentioned before.  I just did a
command line tregsvr and that said success as well, but I'm still getting
the same exception - I just used the BCB de{*word*81} and traced the exception
to this line:
"atlbase.h": 2834 - IMPL_THUNK (16)
I'm pretty sure this should never be called, but I have no idea how
execution managed to get to this point, since the call stack says the
calling program jumped straight to it (in this case, the program is the
ActiveX Test Container).

I just tried importing my ActiveX control into a new Application, and get
the following message: "Error loading type library/dll".  I get the same
message when trying to import the Type Library.

Is there any files I can post that may help you understand whats going on?
Also, I'm running BCB Pro 5, build 12.34 Update Pack 1, on w2k sp2.

Quote
<aphr...@minasanor.borland.com> wrote in message

news:a6jihb$q14$1@minasanor.borland.com...
Quote
> In article <3c8d3ce3$1_2@dnews>, Micah Mason <mma...@spsmail.com> wrote:
> >My first attempts were to register the object and then add it to my VC
app
> >by selecting it from a list of registered controls.  I then tried adding
the
> >object directly into the project by importing the OCX file - VC gave me
this
> >error:

> ahhh. it sounds like registration failed. did you try registering
> with tregsvr?

> >Finally, I tried instantiating the control in the VC ActiveX Control Test
> >Container, and it crashed immediately aftewards.

> I've never heard of that behavior before. *puzzled look*

Re:Errors when instantiating an Active Form from an ActiveX Library


Quote
In article <3c8d5a01$1_1@dnews>, Micah Mason <mma...@spsmail.com> wrote:
>I previously used the Run-Register ActiveX Server command, and that said
>success but then gave me the results I mentioned before.  I just did a
>command line tregsvr and that said success as well, but I'm still getting
>the same exception - I just used the BCB de{*word*81} and traced the exception
>to this line:
>"atlbase.h": 2834 - IMPL_THUNK (16)
>I'm pretty sure this should never be called, but I have no idea how

Not at all. :) This is a thunk used by query interface to jump to
the implementation --- in this case of the 16th method on the interface.

I have absolutely no idea why this would happen --- eg., if the impl_thunk
says there is no implementation, i don't see how you could have gotten there.

Re:Errors when instantiating an Active Form from an ActiveX Library


Well, the problem has gone away :)
The problem did indeed have to do with how i was instantiating my COM
objects.  this code works:

 hr = CoGetClassObject (CLSID_McrDlgLogin, CLSCTX_INPROC_SERVER, NULL,
IID_IClassFactory, (void **)&pMcrDialogs);

 if (pMcrDialogs)
 {
  hr = pMcrDialogs->CreateInstance (NULL, IID_IMcrDlgLogin, (void
**)&pMcrDlgLogin);
[clip]

Quote
}

For some reason the automated software was unable to access my COM objects.
Not a big deal, since I can now safely pass idl files between projects and
use automated software to build appropriate header files.  Thanks for your
help.

Quote
<aphr...@minasanor.borland.com> wrote in message

news:a6ljmd$rpj$1@minasanor.borland.com...
Quote
> In article <3c8d5a01$1_1@dnews>, Micah Mason <mma...@spsmail.com> wrote:
> >I previously used the Run-Register ActiveX Server command, and that said
> >success but then gave me the results I mentioned before.  I just did a
> >command line tregsvr and that said success as well, but I'm still getting
> >the same exception - I just used the BCB de{*word*81} and traced the
exception
> >to this line:
> >"atlbase.h": 2834 - IMPL_THUNK (16)
> >I'm pretty sure this should never be called, but I have no idea how

> Not at all. :) This is a thunk used by query interface to jump to
> the implementation --- in this case of the 16th method on the interface.

> I have absolutely no idea why this would happen --- eg., if the impl_thunk
> says there is no implementation, i don't see how you could have gotten
there.

Other Threads