Hi,
I have an activex OCX written in VC++ exposing a set of methods and events
with parameters. I've tried to load this in a C# windows form and it works
good. Iam able to call the methods and capture the events.
My real requirement is, I need to invoke this ocx methods and events from
a class (.cs) file preferrably in ASP.NET . The idea behind this is, I want
to gather the results of the ocx at the web server and not on the client. If
I embed this in a asp.net page , then the ocx will run on the client page.
I tried invoking the methods in a class file and got
InvalidActivexStateException . Any clue will be of great help.
I have one more question. When I tried to refer the ocx from the Windows
form Tools it generated two dlls. One having a "Ax" prefix and the other
with the exact dll name.
What is the difference between these ?
Which one should I have to use when I have to invoke the ocx from a class ?
I tried with both dll's [the "Ax" prefixed one gave me this
InvalidActivexStateException exception and the ordinary dll gave a
catastrophic failure error.
Thanks in Advance.
Regards,
Suresh Gladstone
Christian Fröschlin - 10 Mar 2008 11:47 GMT
> I tried invoking the methods in a class file and got
> InvalidActivexStateException . Any clue will be of great help.
The OCX likely contains ActiveX controls, not classes, which
need to live in a container to work properly. Instantiate the
control (from the Ax*.dll); add it to the controls collection
of a Windows Form (it shouldn't actually need to be visible).
Suresh Gladstone - 11 Mar 2008 12:06 GMT
Hi,
Thanks for the info. But what I really look for is a way to instantiate this
object without placing it in a UI container.I will not have a form in this
case. Any clues on this basis.
Regards,
Suresh
> > I tried invoking the methods in a class file and got
> > InvalidActivexStateException . Any clue will be of great help.
[quoted text clipped - 3 lines]
> control (from the Ax*.dll); add it to the controls collection
> of a Windows Form (it shouldn't actually need to be visible).
Willy Denoyette [MVP] - 11 Mar 2008 12:57 GMT
> Hi,
> Thanks for the info. But what I really look for is a way to instantiate
[quoted text clipped - 12 lines]
>> control (from the Ax*.dll); add it to the controls collection
>> of a Windows Form (it shouldn't actually need to be visible).
You can't, ActiveX controls (OCX) are designed to be hosted in an AX
container.
Willy.