| View previous topic :: View next topic |
| Author |
Message |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Fri Apr 04, 2008 11:06 pm Post subject: C++ string to int |
|
|
i've got a LPTSTR, and im trying to convert it to an integer, so i can use it for a Sleep command
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Apr 05, 2008 12:15 am Post subject: |
|
|
I'm taking a guess that you're letting the user input the delay?
GetDlgItemInt
otherwise, outside of x0r's answer, what about stringstream?
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat Apr 05, 2008 12:32 am Post subject: |
|
|
ahh thanks, could be handy, but is there a way to do it without the dlg item, i haven't defined em
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Apr 05, 2008 12:35 am Post subject: |
|
|
| Where's the string coming from then?
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat Apr 05, 2008 12:44 am Post subject: |
|
|
like using WM_GetString, but without using the dlgitem value, i haven't defined em
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Apr 05, 2008 1:24 am Post subject: |
|
|
e: I seriously have down syndrome and will stop replying half asleep.
If by WM_GETSTRING do you mean EM_GETLINE / WM_GETTEXT?
Last edited by hcavolsdsadgadsg on Sat Apr 05, 2008 3:13 am; edited 1 time in total |
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat Apr 05, 2008 1:41 am Post subject: |
|
|
well i think i am using dialogs
i tried to do that yeh, but my conversion screwed up, theres a a thread about it in this section, see if you can find out the problem
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Apr 05, 2008 3:14 pm Post subject: |
|
|
If you are using Dialogs, just use the function Slovach already mentioned above.
GetDlgItemInt to obtain an int value.
GetDlgItemText to obtain the string value.
You can also use GetWindowText( ) or SendMessage with WM_GETTEXT.
_________________
- Retired. |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Apr 05, 2008 3:36 pm Post subject: |
|
|
You don't have to be using dialogs to use GetDlgItemInt/Text or any of it's buddies.
You can use it all the same if you created the window and everything yourself.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
|