Thread: Creating a window interface

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    93

    Creating a window interface

    Hi,

    I have started developing a C program which reads a CSV text file, does various maths equations on the data, and then displays the information. The program is designed to run in console, however now I am trying to make the program work as a window application.

    Ive never done this kind of thing before, and ive had a hard time on the internet finding information, so I was hoping I could get a bit of help.

    Does most of the code stay the same, and instead things like printf are changed to display the information? How do i actually insert my code into the window?

    Any help would be much appreciated,

    James

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by spadez View Post
    Does most of the code stay the same, and instead things like printf are changed to display the information? How do i actually insert my code into the window?
    Ha ha ha wouldn't that be nice! You need to use a GUI library to do this. Windows has it's own, or you could use a cross platform library like qt or gtk. However, be warned that the code to display some output will probably dwarf the code that produced the output if it is just a matter of a reading a file and doing some math, and you will wish you never asked ;]
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    93
    Doh, this sounds complicated. When im in visual studio, im able to create a "form" which has a window interface by default. Can this not be used?

    If not, are there example scripts on the web for a basic windows GUI that I could adapt to put my code in?

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by spadez View Post
    Doh, this sounds complicated. When im in visual studio, im able to create a "form" which has a window interface by default. Can this not be used?

    If not, are there example scripts on the web for a basic windows GUI that I could adapt to put my code in?
    I don't know anything about VS (I don't have windows) but I would guess that you can use it if you always want to run the program in visual studio.

    As for the GUI stuff, the hard part is just coming to a conceptual understanding of how a GUI functions. They all use a similar principle -- there is a continuous loop to manage the interface, library routines to do things like catch input, and things called widgets which are the building blocks of the interface. For example, if all you want to do is display some output, you would need a simple interface with a single widget -- a "text area".

    If you aren't very interested in GUI programming, it still might not hurt to spend a few hours with a tutorial that does a "hello world" program (you will be half way there!) But DON'T try to build something around your existing code until you've done a few simple things from scratch. A basic "hello world" is maybe 20-50 lines.

    It won't kill you or cause your head to explode. You don't have to order a set of manuals or get a license. But you will have to devote some time to it -- I'm sure you could have this done by tomorrow, depending on your situation and Coding Comfort Level.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie question about creating a window
    By gozu in forum Windows Programming
    Replies: 1
    Last Post: 01-18-2007, 05:17 PM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  4. Window scrollbar
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-07-2005, 12:31 PM
  5. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM