Looking to get a very simple C++ program made...

Jaxel

Well-known member
Okay, I know nothing about writing Windows C++ applications... my skill in programming comes from web-development, and the program I need done has to work as a windows app. Its very simple, it has text fields, then when the [SAVE] button is clicked, it writes the contents of the text fields to a file.
Untitled-2.webp

Very simple. Clicking the save button would generate an XML file in the program's residing directory called "xSplit.xml". So the image above would generate the following XML construct:
Code:
<game>Soulcalibur V</game>
<round>First Round</round>
<player1>Player One</player1>
<player2>Player Two</player2>
<score1>0</score1>
<score2>0</score2>
<event1>The Break Weekly #146  -  (2012-FEB-07)</event1>
<event2>PLEASE DONATE: (8wayrun.com/donate)</event2>
<event3></event3>
In addition to the text fields, which you'll notice are combo-boxes, you should see some additional buttons. The [Swap Players] button should swap the contents of "player1" and "player2"; as well as swap the contents of "score1" and "score2". The [Reset Scores] button is clicked, it simply zeroes out both score spinboxes.

The program as I explained above should only take about an hour to write, but as I said, I know nothing about windows programming. Getting the program working with the above features is my primary requirement. The image I put together very quickly using Visual Studio C++ 2010 Express.

If you can get a program like this done, please contact me on AIM: BadBreath911.

-----
Everything below this line is not a priority.

You'll notice as well a lot of buttons for [...] and a tab for "Images". I would eventually like to replace the XML file with images. The Images tab should bring up 3 file selection fields, where I can select 3 files for "match.png", "event.png" and "scores.png"... Then when [SAVE] is clicked, it will save the contents of the text fields to the appropriate image and save them as new image in the program's residing directory.

The [...] buttons will bring up configuration settings for each text field. The configuration settings page should have multiple options: left, top, right, bottom for the position the text field should be placed on the image; as well as font-face, font-size and text-alignment settings. If possible I would love to have a multi-line text field on these config pages so I can add items to the database of default options for each text field's drop-down list.
 
Just out of curiosity, but why would it have to be C++? This could just as well be done in C#, vB, Delphi or Java.

C++ would typically be used for heavy mathematical stuff, which this is not. If you just need a program like that done, regardless of the language, I can easily kick that together for you in C#. I don't have AIM, though.

Also, what would feed the comboboxes? Is it a range of pre-defined strings, perhaps residing in text files , or would you need an admin option to define the contents?
 
Well I actually got it all working on my own for C++... took me about 3 hours. I attached the source code in case you wanted to look at it and give me any tips.

I haven't done the png image part... as I can't figure that one out. I dont know how to do the config screens, let alone the png writing.
 

Attachments

I did try several times with failures.
Finally it started to work.
Beautiful language.

I had that with C. When I was younger, I tried Assembler, Pascal, etc. etc. I ended up programming in Visual Basic, and eventually switched to C#, which I now find much more elegant than VB. However, I also took an ANSI C course, and that just isn't for me. I appreciate it is extremely fast and stuff, but I much prefer sacrificing a bit of speed for the user friendliness offered by C#.
 
I had that with C. When I was younger, I tried Assembler, Pascal, etc. etc. I ended up programming in Visual Basic, and eventually switched to C#, which I now find much more elegant than VB. However, I also took an ANSI C course, and that just isn't for me. I appreciate it is extremely fast and stuff, but I much prefer sacrificing a bit of speed for the user friendliness offered by C#.
C# is by far the superior language :D
 
C# is by far the superior language :D

It entirely depends on what you want to achieve, and what platform you run. As stated, I took a course in C, back then while being employed by a company that relied on an old mainframe, Linux and DB2. Their primary purpose was moving bucketloads of data from one place to another as fast as possible.

All of that combined meant that C was their language of choice. C# adds lots of overhead, but in exchange for that, you get all the nice functionality. I.e. a Substring function does not exist in plain ANSI C. That means C has way less overhead, due to not having to load all the libraries and functionality needed for it, but it does mean you either have to load them yourself, or build the functionality yourself. You also do not have the luxury of a garbage collector or memory management, which saves resources, but if you know what you're doing and build in safety precautions, your program will thus be able to run faster and more efficient.

I still prefer C# though ;)
 
Well I rewrote the program in C#... please take a look at if you will and give me some tips if you have any.

Also, if you could expand on it, that would be great too... I would like the [...] buttons to function, but I have no idea how to do that.
 

Attachments

Well I rewrote the program in C#... please take a look at if you will and give me some tips if you have any.

Also, if you could expand on it, that would be great too... I would like the [...] buttons to function, but I have no idea how to do that.

I didn't really have time to check the code in detail, but this is how I usually do a dialogue window for retrieveing files from the OS:

Code:
            FileStream logfile;
                OpenFileDialog openFileDialog1 = new OpenFileDialog();

                openFileDialog1.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                openFileDialog1.Filter = "log files (*.log)|*.log|txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog1.FilterIndex = 0;
                openFileDialog1.RestoreDirectory = true;

                if (openFileDialog1.ShowDialog() == DialogResult.OK) {
                    try {
                        logfile = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    }
                    catch (Exception ex) {
                        MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                    }
                }
 
Top Bottom