473,834 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using ActiveX in C#

Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan
Nov 15 '05 #1
7 13089
Hello Stefan,
CreateObject --> ???
Take a look at the System.Activato r.CreateInstanc e(...) and
System.Type.Get TypeFromProgID( ...)
GetObject --> ???
Not sure there's an equivalent. I hope somebody else will shed more light on
this.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. . Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan


Nov 15 '05 #2

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Hello Stefan,
CreateObject --> ???
Take a look at the System.Activato r.CreateInstanc e(...) and
System.Type.Get TypeFromProgID( ...)
GetObject --> ???


Not sure there's an equivalent. I hope somebody else will shed more light

on this.
Urmm, although I don't know how to use it:
System.Runtime. InteropServices .Marshal.BindTo Moniker(); should be what you
need.
from MSDN:
Marshal.BindToM oniker exposes the BindToMoniker COM API method, which
produces an object that you can cast to any COM interface you require. This
method provides the same functionality as the GetObject method in Visual
Basic 6.0 and Visual Basic .NET. For additional information about the
BindToMoniker COM method, see the MSDN Library.

I had to use it to activate someting one time...using a string like
new://progid but I don't recall exactly what it did and knew nothing beyond
that...
hopefully someone else can shed more light on this as well, ;)
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan

Nov 15 '05 #3
>
GetObject --> ???


System.Runtime. InteropServices .Marshal.GetAct iveObject()
is the good one.

Nov 15 '05 #4
What about the way Microsoft is suggesting to bind COM-objects to managed
code?
They suggest to add a reference to the COM-class to the reference list of
the project, wich will
generate a managed assembly wrapping the COM-class. Then they'll bind it the
folowing way:

....
using NameOfImportedC OMLib; //Just the wrapper-assemblies namespace
....
{
NameOfImportedC OMLibClass myInstance = new NameOfImportedC OMLibClass
();//Creating an object from wrapper class as with any other class
myInstance.DoSu mptin ();//Use as any other object
...
}
....

Stefan

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> schrieb
im Newsbeitrag news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Hello Stefan,
CreateObject --> ???
Take a look at the System.Activato r.CreateInstanc e(...) and
System.Type.Get TypeFromProgID( ...)
GetObject --> ???


Not sure there's an equivalent. I hope somebody else will shed more light

on this.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan

Nov 15 '05 #5
This actually won't work, as it would create a new instance of the
object in question. When using GetObject, it will get an object that is
already created, and located where that resource is (which is typically the
Running Object Table, but can be anything).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Scarfeet" <sc******@opera mail.com> wrote in message
news:ut******** ******@TK2MSFTN GP11.phx.gbl...
What about the way Microsoft is suggesting to bind COM-objects to managed
code?
They suggest to add a reference to the COM-class to the reference list of
the project, wich will
generate a managed assembly wrapping the COM-class. Then they'll bind it the folowing way:

...
using NameOfImportedC OMLib; //Just the wrapper-assemblies namespace
...
{
NameOfImportedC OMLibClass myInstance = new NameOfImportedC OMLibClass
();//Creating an object from wrapper class as with any other class
myInstance.DoSu mptin ();//Use as any other object
...
}
...

Stefan

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> schrieb im Newsbeitrag news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Hello Stefan,
CreateObject --> ???
Take a look at the System.Activato r.CreateInstanc e(...) and
System.Type.Get TypeFromProgID( ...)
GetObject --> ???


Not sure there's an equivalent. I hope somebody else will shed more

light on
this.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan


Nov 15 '05 #6
Stefan,

I had to do this very thing yesterday with CreateObject. Here's what
worked for me.

VB
Set xmlReq = CreateObject("M icrosoft.XMLHTT P")
C#
MSXML.XMLHTTPRe quest xmlReq = (MSXML.XMLHTTPR equest)
Activator.Creat eInstance(Type. GetTypeFromProg ID("Microsoft.X MLHTTP"));
seems like a lot more to write out.. but it works like a charm.

Kevin

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message news:<09******* *************** ******@phx.gbl> ...
Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan

Nov 15 '05 #7
Nice... but,

doesn't seem to work with ActiveX controls.
Looking into it I have observed that the designer creates another kind of
wrapper for ActiveX controls, if I create a reference via the toolbox.
The Objectbrowser shows that reference as "axinterop.Name OfTheImportedLi b".
Using the wrapper contained there just works fine for me.
The code looks like this:
....
using AxNameOfTheImpo rtedLib; //The wrappers namespace created by the
designer
....
{
//AxNameOfTheImpo rted is just the wrapper class available in
//namespace AxNameOfTheImpo rtedLib
AxNameOfTheImpo rted myInstance = new AxNameOfTheImpo rted ();
myInstance.Crea teControl(); //Just force the damn thing to be created
;-)
myInstance.DoSu mptin(); //You can now start to use the controls members
...
}

Scarfeet


"Kevin" <cw****@insight .rr.com> schrieb im Newsbeitrag
news:18******** *************** **@posting.goog le.com...
Stefan,

I had to do this very thing yesterday with CreateObject. Here's what
worked for me.

VB
Set xmlReq = CreateObject("M icrosoft.XMLHTT P")
C#
MSXML.XMLHTTPRe quest xmlReq = (MSXML.XMLHTTPR equest)
Activator.Creat eInstance(Type. GetTypeFromProg ID("Microsoft.X MLHTTP"));
seems like a lot more to write out.. but it works like a charm.

Kevin

"Stefan Saur" <an*******@disc ussions.microso ft.com> wrote in message

news:<09******* *************** ******@phx.gbl> ...
Hello,

I have the commands to access the AutoCAD database via
ActiveX within a VB application. Now I am searching for
the equivalent commands in C#:

VB --> C#
GetObject --> ???
CreateObject --> ???
Can you help me?

Thx
Stefan

Nov 15 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2828
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) My code is below. I am getting the following error "MyForm.oNetwork.Value is Null or is not an object". I'm struggling to diagnose what to do next. I'd very much appreciate some help Many thanks <HTML><BODY><FORM NAME="MyForm"...
6
23770
by: Sergio Otoya | last post by:
Hi all, Is there any way of copying a file using javascript, not using the Filesystemobject (ActiveX). I need this to run in Windows and MACS. Any help would be greatly appreciated. Thanks in advance. Sergio Otoya.
1
4182
by: Norman Fritag | last post by:
Hi there I have avoided to use active x controls because I thought they are causing more problems then they are doing any good. I a new application I would want to use the tree and list view control in access 2002. Prior to that I like to fine some information or here some feed back from developers who have use active x controls success fully in there application, what their experience was.
1
2436
by: Raed Sawalha | last post by:
Hello I have ActiveX DLL and I usually register it using following procedure 1. gactutil -i ActiveXDLL 2. regasm ActiveXDLL /tlb:DLLNAME/codebase 3. then using the activeX can I automate step 1 and 2 inside ActiveX itself
3
2332
by: fumihiko | last post by:
Hi, I created an activex control (C++), and it uses another COM dll (C++). This COM dll links with a static library that dose some calculation. (both are debug multithreaded dll) I created a C# client having activex control embedded at the very beginning (added in the design window); then, I created another same activex control at the runtime. After the 2nd activex control is created, I start to get errors on the function calls to the...
2
1801
by: Mehr H | last post by:
I have been working on this for several days and am still have had no success in achieving this. Pleae help. It seems that documentation for this is very limited. I have looked in several books and they all seem to say either nothing about this or that this is "out of the scope of this book", even "Professional ASP.NET". I have a ActiveX component that I'd like to expose through a .NET wrapper so in the case that a client browses to my...
3
22859
by: EJ1003 | last post by:
Hello I would like to create Activex Control uisng C# and use it in ASP.Net webform. User Control is not solving my requirement so I am going for Activex Control. Please guide me on this, how to do it, if any sample is provided will be of great help Thanks EJ
9
2269
by: Prabhat | last post by:
Hi Friends, I have created one ActiveX DLL in VB that has one public function ("GetClientCPUID") which will return a string of the CPUID. I want to use this to get the clients CPUID and retuern to webserver. I am new to using activeX in client side. In Asp how can I send this ActiveX to client browser? (I will instruct my users to allow this activeX). Is there a way I will execute this activeX in clients PC and get the return value...
3
1864
by: tuvman | last post by:
We are developing a web application. Our web app is a heavy client- our existing .net app exposed as an activex control running in IE. We need the activex to be able to access our remote database server when hosted within a browser from anywhere.Originally we were planning on using port forwarding...and having the externalip:databaseport forward from the web server to the database server. But our customer's network admin says this is not...
0
9796
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10782
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10543
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10213
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9323
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3078
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.