Porting VC++ to C#??

B

Bob C.

Hi All,

I have MFC Based ActiveX Control developed using VC++ 6.0.
It uses lot of GDI stuff like Device Context, Bitmaps,Metafiles and
etc...Property Pages etc...

Now i wanted to port this ActiveX code into .NET. Mostly in C# .NET.
It will be great if any of you guide me to select best way of doing it.

Thanks,
Bob.
 
J

Joe Delekto

Greets,

Since you already have most of your development in C++, you can move over
a good portion of that code into Managed C++ classes. If you choose to move
all of the code to C#, you will most likely end up using P/Invoke calls into
the Win32 APIs you are already using. You should be able to use them within
managed code, most of your work will be spent dealing with the .NET types.
Once you've created your Managed C++ class library, you will easily be able
to add your DLL as a reference to a C# app and use it as you would the other
..NET APIs.

Regards,

Joe
 
N

Nicholas Paldino [.NET/C# MVP]

Bob,

It's hard to say the best way of porting the code, since we can't
actually see the code. However, you should be able to do most of what you
want to do (some things are easie, some are harder, and you always have the
P/Invoke layer and COM interop to fall back on for functionality that is not
provided).

However, if you are still hoping to be able to export an ActiveX control
from .NET, you can not, it is not supported. There is a workaround
published Chris Sells, but it is VERY unsupported.

Hope this helps.
 
S

Sam Gentile [MVP - C#/.NET]

Chris and I wrote an MSDN article for C++ MFC Programmers moving to Windows
Forms that may be of some help:
http://msdn.microsoft.com/library/d...l/vctchWindowsFormsForManagedCProgrammers.asp

--
-----
Sam Gentile
Microsoft MVP - C#/.NET
..NET Blog http://samgentile.com/blog/

Please do NOT contact me directly but respond to
the newsgroup instead.
---------
Nicholas Paldino said:
Bob,

It's hard to say the best way of porting the code, since we can't
actually see the code. However, you should be able to do most of what you
want to do (some things are easie, some are harder, and you always have the
P/Invoke layer and COM interop to fall back on for functionality that is not
provided).

However, if you are still hoping to be able to export an ActiveX control
from .NET, you can not, it is not supported. There is a workaround
published Chris Sells, but it is VERY unsupported.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Bob C. said:
Hi All,

I have MFC Based ActiveX Control developed using VC++ 6.0.
It uses lot of GDI stuff like Device Context, Bitmaps,Metafiles and
etc...Property Pages etc...

Now i wanted to port this ActiveX code into .NET. Mostly in C# .NET.
It will be great if any of you guide me to select best way of doing it.

Thanks,
Bob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top