PaeneInsula
PaeneInsula

Reputation: 2100

adding simple windows ui to console app

I have a C console app, using VS2010, to which I would like to add a simple Window interface. (All the program does is a simple loop: get some input from the user, run the program, produce a single number as a result, continue). The input from the user basically involves just modifying the values of a C structure:

struct input {
  int howMany;
  char name[100];
  int style;
  char child[100];
  char parent[100];
  bool useShoes;
  double weight;
}

Ideally, I'd like to pass a structure in, let the user make any changes, and get it back. What is the easiest way to go about this for someone who doesn't want to spend a few days learning a new scripting or programming language ? (I only know C...what can I say, I was an English major...)

Upvotes: 2

Views: 1118

Answers (3)

uday
uday

Reputation: 8720

To create a window you need Form class in C#,

Create the Windows Forms project in VS2010. And you can embed your code there, but you have do write extra lines of code or convert code to C# to map the user input also the console output to the Windows forms which is pretty straight forward.

Here are the easy learning MSDN links to get started.

http://msdn.microsoft.com/en-us/library/ms229601.aspx

Hope it helps.

Upvotes: -1

Doug Richardson
Doug Richardson

Reputation: 10821

You're either going to have to learn a new language or a new framework you're not familiar with. If you want to use straight C on Windows, you can use the Win32 API to create a window. However, Win32 is old, crusty, and not as easy to use are other frameworks. If you're going to be a Windows developer, you'd be better served picking up C#.

Upvotes: 2

Dhaivat Pandya
Dhaivat Pandya

Reputation: 6536

GTK is probably the easiest way (but, not easy at all). Qt will be much better if you can move to C++.

Upvotes: 2

Related Questions