Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2007, 11:45 AM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default How do you Create an ActiveX app in C#

This seemed like a cool solution for a little problem I have. But I can't find any documentation on doing this.

It was fairly easy in VB6. And, of course, is a piece of cake with Java (to develop an Applet that is).

But if anyone knows how to stub it out or where I can get some information on creating ActiveX objects (assuming this is the right name in the new .Net world) I would appreciate it!

Thanks

What you don't know can hurt you!
__________________
What you don\'t know can hurt you!
 
Old September 20th, 2007, 11:49 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well you can't directly, it depends on what you have in mind. You can create a class library and make it COM aware in assembly properties. You can then use it from a COM environment. Look at tlbimp and regasm in the .NET SDK.

--

Joe (Microsoft MVP - XML)
 
Old September 20th, 2007, 11:53 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This channel9 article might help you:

http://channel9.msdn.com/ShowPost.aspx?PostID=32483



================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old September 20th, 2007, 02:31 PM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

I looked at the channel9 article. It looked easy enough, but it didn't work.

What I wanted to do didn't involve IE but I was planning on using the object in another application that is an ActiveX container.

For my test project (UCOne) I used VS2003 w/.Net 1.1 and created a simple Windows User Control from the template. I changed the background color and added a label ("Hello World") to the control. then I compiled the control.

To test UCOne I opened VS2005 and a project I use for testing windows stuff (WinTest). I referenced UCOne and added it to the Form. (I had to do this manually because the IDE couldn't see it. I'm certain this could be fixed with the right settings, but not worth the effort at the moment.) WinTest compiled and voilet! It worked.

To test UCone in IE I wrote a simple web page and added the object as such:
<object id="ucOne" height="100" width="200" classid="C:\Projects\C-Sharp\LocalLib\UCOne\bin\Release UCOne.dll#UCOne.UserControl1" VIEWASTEXT>
</object>
per the instructions at the Channel9 reference. After allowing ActiveX objects on the web page IE just shows me the "object not loaded" icon.

I tried inserting it into PowerPoint. After creating the object from the ucone.dll file and then attempting to activate the object Dependency Walker opened and read the dependencies on the DLL.

I do have an alternative which is writing a plug-in for the application I want to use this in. I haven't tried that yet, but I'm pretty sure it would work.

I may also try the COM Interoperability route recommended by Joe. If I can develop a template it would be handy for other potential applications.

Any more ideas?




What you don't know can hurt you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot create ActiveX component problem [email protected] VS.NET 2002/2003 27 February 27th, 2008 07:09 PM
ActiveX Component can't create an object lihar Access VBA 1 December 20th, 2006 07:52 AM
cannot create activex component - help please cobweb Classic ASP Components 1 September 14th, 2006 08:40 PM
Cannot create ActiveX Component Ron Howerton Pro VB.NET 2002/2003 0 July 18th, 2006 10:33 AM
Create an ActiveX DLL .... miglou VS.NET 2002/2003 1 September 23rd, 2003 08:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.