473,657 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert c# form to C++.Net

Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc
Nov 17 '05 #1
3 18270
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dl l you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #2
thanks, but unfortunately Reflector doesn't cover Managed C++.

Thinking about it though, I'm not sure that we really want to write code in
the Managed c++ syntax.
We will probably just write our C# code outside our managed C++ project and
include the assemblies.
(We are using managed C++ in order to write all new dialogs as win forms. We
can't throw all the c++ code away although I wish we could.)
"Yama" wrote:
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dl l you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #3
What do you mean? It works fine for me.... If I have code written in C# I can
decompile it in managed C++ but in order for that to work I need to reference
the McppLanguage DLL.

A little test:
The Iterator design pattern written in C#:

namespace Iterator
{
internal abstract class AbstractCollect ion
{
// Methods
protected AbstractCollect ion();
public abstract Iterator.Iterat or CreateIterator( );
}

internal abstract class AbstractIterato r
{
// Methods
protected AbstractIterato r();
public abstract Item CurrentItem();
public abstract Item First();
public abstract bool IsDone();
public abstract Item Next();
}

internal class Collection : AbstractCollect ion
{
// Methods
public Collection();
public override Iterator.Iterat or CreateIterator( );

// Properties
public int Count { get; }
public object this[int index] { get; set; }

// Fields
private ArrayList items;
}

public class Form1 : Form
{
// Methods
public Form1();
protected override void Dispose(bool disposing);
private void Form1_Load(obje ct sender, EventArgs e);
private void InitializeCompo nent();
[STAThread]
private static void Main();

// Fields
private Container components;
private TextBox txtIteratorText ;
}

internal class Item
{
// Methods
public Item(string name);

// Properties
public string Name { get; }

// Fields
private string name;
}

internal class Iterator : AbstractIterato r
{
// Methods
public Iterator(Collec tion collection);
public override Item CurrentItem();
public override Item First();
public override bool IsDone();
public override Item Next();

// Properties
public int Step { get; set; }

// Fields
private Collection collection;
private int current;
private int step;
}
}
Compiled then decompiled to C++ using Reflector:
namespace Iterator
{
private __gc abstract class AbstractCollect ion
{
// Methods
protected: AbstractCollect ion();
public: abstract Iterator::Itera tor __gc * CreateIterator( );
};

private __gc abstract class AbstractIterato r
{
// Methods
protected: AbstractIterato r();
public: abstract Iterator::Item __gc * CurrentItem();
public: abstract Iterator::Item __gc * First();
public: abstract System::Boolean IsDone();
public: abstract Iterator::Item __gc * Next();
};

[System::Reflect ion::DefaultMem ber(S"Item")]
private __gc class Collection : public Iterator::Abstr actCollection
{
// Methods
public: Collection();
public: override Iterator::Itera tor __gc * CreateIterator( );

// Properties
public: __property System::Int32 get_Count();
public: __property System::Object __gc * get_Item(System ::Int32
index);public: __property void set_Item(System ::Int32 index, System::Object
__gc * value);

// Fields
private: System::Collect ions::ArrayList __gc * items;
};

public __gc class Form1 : public System::Windows ::Forms::Form
{
// Methods
public: Form1();
protected: override void Dispose(System: :Boolean disposing);
private: void Form1_Load(Syst em::Object __gc * sender,
System::EventAr gs __gc * e);
private: void InitializeCompo nent();
[System::STAThre ad]
private: static void Main();

// Fields
private: System::Compone ntModel::Contai ner __gc * components;
private: System::Windows ::Forms::TextBo x __gc * txtIteratorText ;
};

private __gc class Item
{
// Methods
public: Item(System::St ring __gc * name);

// Properties
public: __property System::String __gc * get_Name();

// Fields
private: System::String __gc * name;
};

private __gc class Iterator : public Iterator::Abstr actIterator
{
// Methods
public: Iterator(Iterat or::Collection __gc * collection);
public: override Iterator::Item __gc * CurrentItem();
public: override Iterator::Item __gc * First();
public: override System::Boolean IsDone();
public: override Iterator::Item __gc * Next();

// Properties
public: __property System::Int32 get_Step();publ ic: __property
void set_Step(System ::Int32 value);

// Fields
private: Iterator::Colle ction __gc * collection;
private: System::Int32 current;
private: System::Int32 step;
};
}
Any questions?

Yama
"James" wrote:
thanks, but unfortunately Reflector doesn't cover Managed C++.

Thinking about it though, I'm not sure that we really want to write code in
the Managed c++ syntax.
We will probably just write our C# code outside our managed C++ project and
include the assemblies.
(We are using managed C++ in order to write all new dialogs as win forms. We
can't throw all the c++ code away although I wish we could.)
"Yama" wrote:
You can compile then decompile your code from C# to C++.NET using Reflector:

http://www.aisto.com/roeder/dotnet/D...File=Reflector

C++ AddIn

http://www.testdriven.net/downloads/...ppLanguage.dll

Steps:

Once downloaded open Reflector
Click the View menu and select the Add-Ins... item.
Click on Add and select the McppLanguage.dl l you downloaded.

1. Compile your program either a DLL or EXE
2. Open it with Reflector
3. Select the language you want your source code decompiled in.
4. Right click on the class your want to decompile.

Hope this helps,

Yama Kamyar

"James" wrote:
Has anyone written a utility to convert a C# form to C++.net?
i.e. to convert "using System.Data" to "using namespace System::Data" etc

Nov 17 '05 #4

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

Similar topics

5
18003
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript function and have JS put this into an array. Then JS would use this array to create a selection list which displays only the names of the drugs. When the user selections one of the drugs, another selection list will be loaded with the avaiable...
4
5364
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
19
4125
by: jeff | last post by:
how do you convert form byte to Int32 while retaining the binary value of the byte array
1
5404
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a web form to upload a TIFF image (scanned images) and convert it to a JPEG before I insert it into SQL Server. The file upload part works great, but I can;t convert the image. I certainly don't want to upload it the the server filesystem, convert...
3
2691
by: Thubaiti | last post by:
Hi, I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategoryRepeater" runat="server"> <ItemTemplate> <ul> <li> <asp:HyperLink id="subCategoryHyperLink" runat="server" NavigateUrl='<%# "subcategory.aspx?subcategoryid=" +
2
4228
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with this. Also - the citrix folks do not want us to keep the FE in Access as the queries and other activities consume a lot of power. The users will be in 3 different offices across the globe all accessing the 1 Oracle DB in Citrix. Does anyone have...
14
7956
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
4
1937
by: faizal87 | last post by:
hallo...can i get some knowladge...about java script convert to V.B....how??like 'calculation downloadable',i've get a formula calculate but in java script....how i want convert this language to V.B This is formula in java script: <script language="JavaScript"> <!-- var gaji; var cpekerja; var cmajikan; var semua;
1
73015
by: rdraider | last post by:
I can't seem to find a way to convert an INT type in the form of YYYYMMDD to an actual date form of mm/dd/yyyy Can anyone pointt me in the right direction? Thanks
0
8425
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
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8845
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...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7355
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
6177
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
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1736
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.