Thread: Need a Graphical screen for C output

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    24

    Need a Graphical screen for C output

    Hello to all...
    I am in the process of learning C language and not an expert programmer. I created a C script that displays a machine's statistics on the screen. Now whole program is ready and is working properly to display desired output. But I need to change few things.
    I need to display the output in a white screen (like a message box) and an 'OK' kind of button at bottom. This script will run on client users when they logon into their computers. This script takes few seconds (4-5) to get executed completely. In between Ctrl+C or Ctrl+z can be pressed by user and script execution will get canceled leaving behind some temporary files created in the process.
    I need to disable these keystrokes, and the standard '- + x' options on top right of output window should not come. I mean user should not be able to cancel or close the execution before it completes. Is that possible in C? Plz try to be specific to C advices only, since I am planning to learn C till depth.
    Moreover, I tried to use getch() or getche() for holding the screen after executing the .exe file. These worked sometimes but now compiler throws error: getche undeclared (first use this function). I am simply puting a getche(); code at the end of program. Now I am forced to use getchar();
    Looking forward for help.
    Thanks

  2. #2
    Registered User
    Join Date
    Jul 2013
    Posts
    41
    You might want to look into GUI's for C - for things like buttons/display screens etc.

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    24
    Thanks stach. Could you plz provide link to any article on GUI's for C (known to you)?
    Any suggestions for getch() & getche() functions? Which header file to use? I am using Bloodshed's Dev-C++ 4.9.9.2 compiler on Win XP. This XP is running on a virtual machone in Linux.

  4. #4
    Registered User
    Join Date
    Jul 2013
    Posts
    41
    Ah. Virtuals I don't tend to use, I go for fit for purpose everytime, probably because I'm not too familiar with that kind of business. In terms of GUI's for C, you'd obviosuly have to look at what is going to work for your VM in Linux. I seem to remember a good one in eclipse for GUI's on Linux but thats going back a bit. Google it, see whats out there, i'm sure theres plenty of good advice on what might work best.

    getche() as far as i'm aware takes input but doesn't wait for user input of 'Enter' lets say, but things like holding screen should be handled by a good GUI system with the correct/efficient libraries. Windows VS is always a first choice for windows, and GTK is something I know is popular in the Ubuntu realm - The GTK+ Project.

    Hope this helps

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    24
    Thanks alot stach. I will get GTK+ for windows, since I have to produce a C program for windows machines. Thanks for help.

  6. #6
    Registered User
    Join Date
    Jul 2013
    Posts
    41
    Yeah I've just been reading into GTK+ - sounds quite comprehensive, might even get it myself!

  7. #7
    Registered User
    Join Date
    May 2012
    Posts
    505
    Quote Originally Posted by kriss332 View Post
    Hello to all...
    I need to display the output in a white screen (like a message box) and an 'OK' kind of button at bottom. This script will run on client users when they logon into their computers. Is that possible in C? Plz try to be specific to C advices only, since I am planning to learn C till depth.
    You can get the graphics up using Microsoft GDI. You have to compile the program as a Windows GUI program, and it enters at winmain. You then have to call an infinite message loop, and hang the code off the messages.
    It's quite a bit of fiddling. But if you just want a button or two, it will be easier than trying to use a huge library built on top.

    The somehow you've got to get the operating system to call your program at login. That's not a C issue, it's about fiddling with msconfig (probably, I'm not an expert on this) and getting the start-up scripts to call your program in the way that you want.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    https://github.com/MalcolmMcLean


  8. #8
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    I started learning GTK+ last week - so far, it seems very friendly for GUI designing. The tutorial on the GTK+ site is a very good one, in my opinion. So I'd second this suggestion.

  9. #9
    Registered User
    Join Date
    Jul 2013
    Posts
    24
    Thanks to all of you. I have started sneaking into winprogramming through winprog. ceems to be quite complex as of now. Also starting to get look at GTK. Malcolm! do you have any link to a good basic Win API programming tutorial?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do you run a job without output going to screen?
    By Fremontknight1 in forum Linux Programming
    Replies: 3
    Last Post: 06-12-2007, 11:19 AM
  2. dos output screen
    By niroopan in forum C++ Programming
    Replies: 1
    Last Post: 09-15-2002, 09:03 AM
  3. output screen
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-03-2002, 04:03 PM
  4. screen output design
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 02-08-2002, 10:14 PM