Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2008

Tip: Looking for answers? Try searching our database.

Invoke Activex OCX  methods and Events from a window library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Suresh Gladstone - 07 Mar 2008 12:45 GMT
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
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



©2008 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.