Visual C# to Visual C++ ??!!


G

Geoff Cox

Hello,

After much effort I have got the Visual C# code below to work using
Visual C# 2005 Express Beta 2 and now I am trying to convert it to
Visual C++ code so that I can use it in Visual C++ 2005 Express Beta
2.

My reason for doing this is that I believe (do tell me if I am wrong!)
that using Visual C++ 2005 Express together with the Windows SDK I
will be able to create a Win32 app which will mean that when this app
is installed on a PC the .NET Framework will not be needed ..... Since
my app is so small it seems foolish to require installation of 20 MB
plus of .NET Framework software ....

So, I am looking for Internet site where I might find help in
converting my code to Visual C++. Visual C++ for beginners needed!

Any ideas please?!

Cheers

Geoff


------------------- Visual C# coce -------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace slider3
{
public partial class Form1 : Form
{

private string[] LHSquestions;
private string[] RHSquestions;
private int qnumber = 0;
private string[] results;
private int count = 0;

public Form1()
{
InitializeComponent();

LHSquestions = new string[]{"question 1","question 2"};
RHSquestions = new string[]{"question 1","question 2"};
results = new string[LHSquestions.Length];

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void trackBar1_Scroll(object sender, EventArgs e)
{

}

private void button1_MouseClick(object sender, MouseEventArgs
e)
{

results[qnumber] = trackBar1.Value.ToString();

++qnumber;

if (qnumber == LHSquestions.Length)
{
endMessage();
}
else
{

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}
}

private void endMessage()
{
this.label1.Text = "Finished!";
this.label2.Text = "Thank you";
this.button1.Visible = false;

TextWriter tw = new StreamWriter("d:\\a-temp1\\data.txt");

for (count = 0; count < LHSquestions.Length; count++)
{
tw.WriteLine("q" + (count+1) + " = " + results[count]);
}
tw.Close();

}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
 
Ad

Advertisements

C

Chris Ward

A different perspective Geoff:

Who is going to use your app? If it is not for widespread use, find out if
your Users already have .Net installed. Most people with newish PCs will
have the .Net framework already there.

Chris
 
P

Peter van der Goes

Hello,

After much effort I have got the Visual C# code below to work using
Visual C# 2005 Express Beta 2 and now I am trying to convert it to
Visual C++ code so that I can use it in Visual C++ 2005 Express Beta
2.

My reason for doing this is that I believe (do tell me if I am wrong!)
that using Visual C++ 2005 Express together with the Windows SDK I
will be able to create a Win32 app which will mean that when this app
is installed on a PC the .NET Framework will not be needed ..... Since
my app is so small it seems foolish to require installation of 20 MB
plus of .NET Framework software ....

So, I am looking for Internet site where I might find help in
converting my code to Visual C++. Visual C++ for beginners needed!

Any ideas please?!

Cheers

Geoff


------------------- Visual C# coce -------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace slider3
{
public partial class Form1 : Form
{

private string[] LHSquestions;
private string[] RHSquestions;
private int qnumber = 0;
private string[] results;
private int count = 0;

public Form1()
{
InitializeComponent();

LHSquestions = new string[]{"question 1","question 2"};
RHSquestions = new string[]{"question 1","question 2"};
results = new string[LHSquestions.Length];

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void trackBar1_Scroll(object sender, EventArgs e)
{

}

private void button1_MouseClick(object sender, MouseEventArgs
e)
{

results[qnumber] = trackBar1.Value.ToString();

++qnumber;

if (qnumber == LHSquestions.Length)
{
endMessage();
}
else
{

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}
}

private void endMessage()
{
this.label1.Text = "Finished!";
this.label2.Text = "Thank you";
this.button1.Visible = false;

TextWriter tw = new StreamWriter("d:\\a-temp1\\data.txt");

for (count = 0; count < LHSquestions.Length; count++)
{
tw.WriteLine("q" + (count+1) + " = " + results[count]);
}
tw.Close();

}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}

I'm going to second Chris' opinion here. The level of effort needed to
convert a C# Windows application to MFC, ATL or straight Windows API (some
choices available for a C++ Windows application not dependent on the .NET
framework) is significant. There is also a rather steep learning curve
involved.
If you do encounter potential clients that require Framework installation,
bear in mind that you just happen to be the first product requiring it. It's
a matter of when, not if.
The link below is typical of the information available on MFC in MSDN. You
can find many similar articles by searching MSDN for "MFC tutorials". They
should give you some idea of the work involved in converting your
application:

http://msdn.microsoft.com/library/d...core98/html/_core_mfc_tutorials_available.asp
 
G

Geoff Cox

A different perspective Geoff:

Who is going to use your app? If it is not for widespread use, find out if
your Users already have .Net installed. Most people with newish PCs will
have the .Net framework already there.

Chris,

Any idea when .NET started to be found in significant numbers?

Cheers

Geoff

Chris

Hello,

After much effort I have got the Visual C# code below to work using
Visual C# 2005 Express Beta 2 and now I am trying to convert it to
Visual C++ code so that I can use it in Visual C++ 2005 Express Beta
2.

My reason for doing this is that I believe (do tell me if I am wrong!)
that using Visual C++ 2005 Express together with the Windows SDK I
will be able to create a Win32 app which will mean that when this app
is installed on a PC the .NET Framework will not be needed ..... Since
my app is so small it seems foolish to require installation of 20 MB
plus of .NET Framework software ....

So, I am looking for Internet site where I might find help in
converting my code to Visual C++. Visual C++ for beginners needed!

Any ideas please?!

Cheers

Geoff


------------------- Visual C# coce -------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace slider3
{
public partial class Form1 : Form
{

private string[] LHSquestions;
private string[] RHSquestions;
private int qnumber = 0;
private string[] results;
private int count = 0;

public Form1()
{
InitializeComponent();

LHSquestions = new string[]{"question 1","question 2"};
RHSquestions = new string[]{"question 1","question 2"};
results = new string[LHSquestions.Length];

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void trackBar1_Scroll(object sender, EventArgs e)
{

}

private void button1_MouseClick(object sender, MouseEventArgs
e)
{

results[qnumber] = trackBar1.Value.ToString();

++qnumber;

if (qnumber == LHSquestions.Length)
{
endMessage();
}
else
{

this.label1.Text = LHSquestions[qnumber];
this.label2.Text = RHSquestions[qnumber];

}
}

private void endMessage()
{
this.label1.Text = "Finished!";
this.label2.Text = "Thank you";
this.button1.Visible = false;

TextWriter tw = new StreamWriter("d:\\a-temp1\\data.txt");

for (count = 0; count < LHSquestions.Length; count++)
{
tw.WriteLine("q" + (count+1) + " = " + results[count]);
}
tw.Close();

}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
 
Ad

Advertisements

G

Geoff Cox

I'm going to second Chris' opinion here. The level of effort needed to
convert a C# Windows application to MFC, ATL or straight Windows API (some
choices available for a C++ Windows application not dependent on the .NET
framework) is significant. There is also a rather steep learning curve
involved.
If you do encounter potential clients that require Framework installation,
bear in mind that you just happen to be the first product requiring it. It's
a matter of when, not if.
The link below is typical of the information available on MFC in MSDN. You
can find many similar articles by searching MSDN for "MFC tutorials". They
should give you some idea of the work involved in converting your
application:

Peter,

Thanks for the advice and the link.

Cheers

Geoff
 

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