Thread: Input for windows programs

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

    Input for windows programs

    I am beginning to understand windows programming, and i know how to "print" text in my programs (MessageBox(); ) but i dont know how to make input. Please tell me.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is an edit control.

    Kuphryn

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    what`s an edit control?

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    I found something about it, but thats way too complicated. I mean similar to cin <<.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I don't have my Petzold book with me, and I'm not going to try and give you any specifics from memory... So here's some general information:

    A "real" Window program has a Windows Processing Loop.
    Whenever you hit a key, or do something with the mouse, a Windows message is sent to you program (i.e. WM_KEYDOWN). The Windows Processing Loop has to intercept and handle the message, or ignore it.

    Here's a link to a Windows Tutorial. Learning Windows is like learning an additional programming language. The Windows library includes a couple-thousand functions, Plus lots of typedefs, constants, and structures.

    Once you have a Window, you can use DrawText() or TextOut() to display test inside your window, without using a message box.

  6. #6
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>I mean similar to cin <<.
    Sorry, there's nothing out there like that unless you download somebody else's pre-made code that uses an edit box anyway.

    Input is generally very very very hard to do like that, unless you use a dialog box program - in which case it's pretty easy. But first you gotta learn how to do a dialog program, so I don't know what you're going to do unless you go and learn it. There is another option - using a non-dialog program but pop up a dialog window - but that's pretty much the same thing, and you'll get confused trying to do both at the same time.

    So my advice: Learn how to do a dialog box with an edit control

    **EDIT**
    I did make something like that once for my Space Shooterz DX game since there was no other way I could find to get text input. You can check it out at the link in my signature, but that's a DirectDraw program so some of it might need to be converted to GDI or something. The file's BlockingIO.h/.cpp in case you're interested. It's not any easier to use than a dialog box though, so be warned.
    Last edited by Hunter2; 08-30-2004 at 05:28 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #7
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    Okay, i'll learn how to use edit controls. Thanks. I`m just a beginner at windows programming, and i`ve only just learned how to create multiple lines of text in a messagebox, so i still got a lot of learning to do.

  8. #8
    Inverse Tangent Studios
    Join Date
    Aug 2004
    Posts
    4
    This may not be much help to you if you aren't using Microsoft Visual C++ (MSVC++), but if you are... visit codeproject.com
    http://www.codeproject.com/cpp/

    this site has all kinds of sample code, tutorials, and just about anything you need for MSVC++. there are all kinds of classes and controls for GUI's- all free for you to use for anything you want. they also have a lot of things for other languages, but i use it for MSVC++ examples and help all the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. input redirection
    By sashaKap in forum C Programming
    Replies: 6
    Last Post: 06-25-2009, 01:59 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM