Getting User Input in Windows
In a dos program I would just use:
cout<< Whats your name?;
cin>> Name
How do I put this in the main event loop in a win32 program?
Im using Visual C++ 6
I can print what is your name using sprintf and TextOut but I cant get it to let me type anything in
Please help
Thanx
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Windows has no standard input stream (or output stream, hence the required use of GDI''s TextOut). To get input you have a few options..
1. have your WindowProc function implement a WM_KEYDOWN message handler
2. create a giant edit control and have it fill your entire window (this is basically how notepad works)
3. open a dialog box with input controls in it
It all depends on what kind of input you want. If you want to prompt the user to give you data, then the third way is best. If you''re trying to emulate notepad, then go with the second way. And if you''re in a game and trying to get keyboard messages, use the first way.
-RWarden (robete@maui.net)
1. have your WindowProc function implement a WM_KEYDOWN message handler
2. create a giant edit control and have it fill your entire window (this is basically how notepad works)
3. open a dialog box with input controls in it
It all depends on what kind of input you want. If you want to prompt the user to give you data, then the third way is best. If you''re trying to emulate notepad, then go with the second way. And if you''re in a game and trying to get keyboard messages, use the first way.
-RWarden (robete@maui.net)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement