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.
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.
One solution is an edit control.
Kuphryn
what`s an edit control?
I found something about it, but thats way too complicated. I mean similar to cin <<.
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.
>>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.
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.
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.