PDA

View Full Version : New C++ Coder looking for answers...


cameronlanni
08-04-2006, 04:22 AM
Hi everyone,

I have recently picked up C++ and am still not great with it, nonetheless, I've decided to try something in an attempt to learn the language better. I basicially am wondering if, using the C++ Console Comand can enter text into a text fiend in a browser window. For example, prompting the user for their username and password in the C++ console, and then entering it to the browser for them - at which point the console would cout >> various information that can be found in the browser.

I do realize that is vague, but I would greatly appreciate any assistance and will answer any questions to furthur your understanding.

Thank you,
Cameron

cameronlanni
08-04-2006, 10:08 AM
Is there a way I can Asterisk out the characters entered on a cin? Perhaps if the user is entering a password for example.

Thanks again

rpgfan3233
08-04-2006, 02:39 PM
at which point the console would cout >> various information that can be found in the browser.
What you are looking for is streams. Unfortunately, I cannot tell you how to use them in combination with a browser to retrieve information. In fact, I'm not sure it can be done. . .

Is there a way I can Asterisk out the characters entered on a cin? Perhaps if the user is entering a password for example.
You would need to create your own input routine or use a library that supports such a thing. cin can't be used for that AFAIK. You would need something lower-level, like Assembly Programming.

oracleguy
08-04-2006, 06:16 PM
You would need to create your own input routine or use a library that supports such a thing. cin can't be used for that AFAIK. You would need something lower-level, like Assembly Programming.

Yeah something like that might work.

Another alternative would be to set the console foreground color the match the background color, I haven't ever tried it on a cin but it might work. And you can do it from C++.

There might be an easy way to hide the text like you want but I've never had to do it so I don't know.

cameronlanni
08-04-2006, 06:41 PM
How do I change forground color or text color in the console?

oracleguy
08-04-2006, 07:28 PM
Try checking this out: http://www.codeproject.com/cpp/AddColorConsole.asp

cameronlanni
08-05-2006, 06:55 PM
Anyone else have an answer to my initial question?

mentalhorse
08-21-2006, 03:10 AM
Yes.
http://msdn2.microsoft.com/en-us/library/ms171548.aspx
Try checking that out. Near the middle it has some information on how to send keystrokes to other applications. Just make sure you look under the c++ part.
I was actually trying to help you with your second thing with the asteriks, looking for a simulated key press and stumbled across this. Hope it helps.

xuancongwen
08-21-2006, 10:21 PM
You don't need assembly to do the input of the password.

Use the getch() function and an if-elseif-else. Simple, and no need to learn what register is what for your specific computer architecture. Absolutely no assembly required.

mentalhorse
08-25-2006, 01:40 AM
Use the getch() function and an if-elseif-else
AFAIK when you use getch() it shows the character on the screen.

rpgfan3233
08-25-2006, 06:53 AM
AFAIK when you use getch() it shows the character on the screen.
Which getch() function are we discussing? The one provided by the conio library or a different one? conio's getch() function doesn't "echo" the keystrokes. getche() is used for that. If that doesn't work for you, there is the GetAsyncKeyState() function provided by the Win32 API, though this one might need a lot of coding.