1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Off Topic' started by Jaxel, Feb 7, 2012.

  1. Jaxel

    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.
    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:
    <game>Soulcalibur V</game>
    <round>First Round</round>
    <player1>Player One</player1>
    <player2>Player Two</player2>
    <event1>The Break Weekly #146  -  (2012-FEB-07)</event1>
    <event2>PLEASE DONATE: (8wayrun.com/donate)</event2>
    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.
  2. SchmitzIT

    SchmitzIT Well-Known Member

    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?
  3. Jaxel

    Jaxel Well-Known Member

    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.

    Attached Files:

  4. SchmitzIT

    SchmitzIT Well-Known Member

    Unfortunately I never dabbled in C++. Well, actually, I tried, and then decided to stay far, far away from it, lol.
  5. whynot

    whynot Well-Known Member

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

    SchmitzIT Well-Known Member

    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#.
  7. jmurrayhead

    jmurrayhead Well-Known Member

    C# is by far the superior language :D
  8. SchmitzIT

    SchmitzIT Well-Known Member

    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 ;)
    jmurrayhead likes this.
  9. jmurrayhead

    jmurrayhead Well-Known Member

    Guess I should have quoted the specific piece I was referring to. I was talking more along the lines of VB vs C#, just for the sake of starting the C# vs VB battle :sneaky: Anyway, guess we took this thread of course... :oops:
  10. Jaxel

    Jaxel Well-Known Member

    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.

    Attached Files:

  11. Digital Doctor

    Digital Doctor Well-Known Member

    simple C++

    = oxymoron ?
    Mikey, SchmitzIT and Fuhrmann like this.
  12. SchmitzIT

    SchmitzIT Well-Known Member

    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:

                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);

Share This Page