How to use .NET components in VC++ .NET 
Author Message
 How to use .NET components in VC++ .NET

I am having trouble customizing the VC++ toolbox to show my .NET framework
components.  How can I do this? For VB all I had to do was click on my
desired component and it showed up on the toolbox, this is not working for
VC++.

Delali Dzirasa



Sun, 02 Jan 2005 23:00:16 GMT  
 How to use .NET components in VC++ .NET
Try deriving it from UserControl. (This works in C# at least)  Otherwise,
there might be some attribute you can tack on.

-Sean


Quote:
> I am having trouble customizing the VC++ toolbox to show my .NET framework
> components.  How can I do this? For VB all I had to do was click on my
> desired component and it showed up on the toolbox, this is not working for
> VC++.

> Delali Dzirasa



Mon, 03 Jan 2005 01:09:10 GMT  
 How to use .NET components in VC++ .NET
sorry I am a little new to this, could you please explain a little more what
you mean?

Delali

Quote:
> Try deriving it from UserControl. (This works in C# at least)  Otherwise,
> there might be some attribute you can tack on.

> -Sean



> > I am having trouble customizing the VC++ toolbox to show my .NET
framework
> > components.  How can I do this? For VB all I had to do was click on my
> > desired component and it showed up on the toolbox, this is not working
for
> > VC++.

> > Delali Dzirasa



Mon, 03 Jan 2005 01:16:07 GMT  
 How to use .NET components in VC++ .NET
This is what I meant, but after trying it, it still won't solve your
problem.

public __gc class MyControl :
    public System::Windows::Forms::UserControl
{

Quote:
};

-Sean

Quote:
> sorry I am a little new to this, could you please explain a little more
what
> you mean?

> Delali


> > Try deriving it from UserControl. (This works in C# at least)
Otherwise,
> > there might be some attribute you can tack on.

> > -Sean



> > > I am having trouble customizing the VC++ toolbox to show my .NET
> framework
> > > components.  How can I do this? For VB all I had to do was click on my
> > > desired component and it showed up on the toolbox, this is not working
> for
> > > VC++.

> > > Delali Dzirasa



Mon, 03 Jan 2005 04:19:15 GMT  
 How to use .NET components in VC++ .NET
You need to give it a strong name, add it to the GAC and drag it to the
toolbar. VB/C# do the first 2 for you automatically.

Ronald


Quote:
> I am having trouble customizing the VC++ toolbox to show my .NET framework
> components.  How can I do this? For VB all I had to do was click on my
> desired component and it showed up on the toolbox, this is not working for
> VC++.

> Delali Dzirasa



Mon, 03 Jan 2005 04:52:31 GMT  
 How to use .NET components in VC++ .NET
ok, could you please show me an example of how to do this?
(either the specific steps or possible an online tutorial)

thanks you help is greatly appreciated!!

Delali



Quote:
> You need to give it a strong name, add it to the GAC and drag it to the
> toolbar. VB/C# do the first 2 for you automatically.

> Ronald



> > I am having trouble customizing the VC++ toolbox to show my .NET
framework
> > components.  How can I do this? For VB all I had to do was click on my
> > desired component and it showed up on the toolbox, this is not working
for
> > VC++.

> > Delali Dzirasa



Mon, 03 Jan 2005 10:43:22 GMT  
 How to use .NET components in VC++ .NET
Delali,

Quote:
> ok, could you please show me an example of how to do this?
> (either the specific steps or possible an online tutorial)

The steps mentioned by Ronald more or less go like this:

1- Use sn.exe from the command line to generate a strong name, with the
line:
    sn.exe -k <somefile.snk>

2- Drop that file somwhere you can use it (say, in your project's dir), and
use the AssemblyKeyFile attribute to signal the compiler where the .snk file
is:
    [assembly: AssemblyKeyFileAttribute("somefile.snk") ]

3- compile, and then use the gacutil.exe tool to register your component on
the gac:
    gacutil.exe /i your.dll

--
Tomas Restrepo



Mon, 03 Jan 2005 11:10:26 GMT  
 How to use .NET components in VC++ .NET
thanks...I want to make sure that I am doing this correctly though:

Quote:
> 1- Use sn.exe from the command line to generate a strong name, with the
> line:
>     sn.exe -k <somefile.snk>

Done

Quote:
> 2- Drop that file somwhere you can use it (say, in your project's dir),

Done

Quote:
> use the AssemblyKeyFile attribute to signal the compiler where the .snk
file
> is:
>     [assembly: AssemblyKeyFileAttribute("somefile.snk") ]

Where do I need to write this code

Quote:
> 3- compile, and then use the gacutil.exe tool to register your component
on
> the gac:
>     gacutil.exe /i your.dll

I think that this may no be a problem after I get finished with the step
before this one, but one question how does this step of registering the
component connect with the key file? when/how are the two assocuated?

When all of this is finished how would I get the component on the toolbox,
through "customize?"



Quote:
> Delali,

> > ok, could you please show me an example of how to do this?
> > (either the specific steps or possible an online tutorial)

> The steps mentioned by Ronald more or less go like this:

> 1- Use sn.exe from the command line to generate a strong name, with the
> line:
>     sn.exe -k <somefile.snk>

> 2- Drop that file somwhere you can use it (say, in your project's dir),
and
> use the AssemblyKeyFile attribute to signal the compiler where the .snk
file
> is:
>     [assembly: AssemblyKeyFileAttribute("somefile.snk") ]

> 3- compile, and then use the gacutil.exe tool to register your component
on
> the gac:
>     gacutil.exe /i your.dll

> --
> Tomas Restrepo




Mon, 03 Jan 2005 21:40:35 GMT  
 How to use .NET components in VC++ .NET
I am getting some errors that I am not sure how to get rid of.

I am working with a Managed C++ app in VC++.NET

I am attempting to create a GUI for some existing C++ code, so I created a
Win form using the following namespaces: System::Windows::Forms

I tested the Form and it seems to work fine, but when I try to add some of
my old files to the proj, I get the following errors:

C:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ObjIdl.h(245) : warning C4935: assembly access
specifier modified from 'public'C:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ObjIdl.h(257) :

warning C4935: assembly access specifier modified from 'public'C:\Program
Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\ObjIdl.h(7371) :

 error C2872: 'IDataObject' : ambiguous symbol        could be 'C:\Program
Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\ObjIdl.h(7385) :
IDataObject'        or       'c:\Documents and
Settings\dzirad1\Desktop\CHARTING Trial\NarwalChart\ChartForm.h(3) :
System::Windows::Forms::IDataObject'C:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ObjIdl.h(7597) :

error C3383: 'IOleCache2::UpdateCache' : in an unmanaged class, a virtual
member function cannot have a managed type in the signaturec:\Program
Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\OleIdl.h(799) :
error C3383: 'IOleCacheControl::OnRun' : in an unmanaged class, a virtual
member function cannot have a managed type in the signaturec:\Program
Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\OleIdl.h(1415) :

warning C4935: assembly access specifier modified from 'public'c:\Program
Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\ServProv.h(92) :

error C2872: 'IServiceProvider' : ambiguous symbol        could be
'c:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ServProv.h(47) : System::IServiceProvider
IServiceProvider'        or       'c:\Documents and
Settings\dzirad1\Desktop\CHARTING Trial\NarwalChart\ChartForm.h(1) :
System::IServiceProvider'c:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ServProv.h(99) :

fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not
#include

One of the files that I added from my old code was one that included
windows.h
this header is needed for the file to compile, so I can not erase it.

Not sure how to get around this.

Any help would be greatly appreciated.

Delali Dzirasa



Sat, 15 Jan 2005 01:33:07 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. ATL component written in VC.NET 2002 won't register on non .NET machine

2. ATL component written in VC.NET 2002 won't register on non .NET machine

3. Problem converting VC6 ATL component to a .NET 2003 VC ATL component

4. Using VB .Net and VC at the same time in .Net

5. Calling vs.net component from vc++ 6

6. ANN: Smtp.NET Mail component for .NET

7. Challenge/Help VB.NET VC++.NET VC++6.0

8. Slower compilation with VC Net 2003 (7.1) when compared to VC Net 7.0

9. Using .NET Components in COM

10. Interop problem with VC.NET ATL Component..

11. Can we build database components in VC.net?

12. Serviced Component Example in VC.NET

 

 
Powered by phpBB® Forum Software