| View previous topic :: View next topic |
| Author |
Message |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Tue Jan 26, 2010 12:19 am Post subject: [C++ - Help] compre text to text with "if" functio |
|
|
hi guys , i am treing to do some thing like that ,
| Code: |
if(GetItemDlgText(HWND , IDC_COMBO1 ) == "Z")
do something (LOL)....
|
i think it may be convert string to int///
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Jan 26, 2010 2:12 am Post subject: |
|
|
GetItemDlgText doesn't exist, you want
| Code: | UINT GetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
); |
| Quote: | Parameters
hDlg
[in] Handle to the dialog box that contains the control.
nIDDlgItem
[in] Specifies the identifier of the control whose title or text is to be retrieved.
lpString
[out] Pointer to the buffer to receive the title or text.
nMaxCount
[in] Specifies the maximum length, in TCHARs, of the string to be copied to the buffer pointed to by lpString. If the length of the string, including the NULL character, exceeds the limit, the string is truncated.
Return Value
If the function succeeds, the return value specifies the number of TCHARs copied to the buffer, not including the terminating NULL character.
If the function fails, the return value is zero. To get extended error information, call GetLastError. |
std::string can take a char* in it's constructor, so you can use that.
or i guess just go with strcmp.
edit: i'd prob just wrap those (window Get/Setxxx) functions to work with std::string anyway. you can use a template + stringstream to handle the conversions. sounds much nicer / cleaner to me.
Last edited by hcavolsdsadgadsg on Tue Jan 26, 2010 2:35 am; edited 1 time in total |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Jan 26, 2010 2:12 am Post subject: |
|
|
| string comparison can be done with _tcsclen_s()
|
|
| Back to top |
|
 |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Tue Jan 26, 2010 7:10 am Post subject: |
|
|
| Slugsnack wrote: | | string comparison can be done with _tcsclen_s() |
can u give me an example please?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Jan 26, 2010 7:18 pm Post subject: |
|
|
how about something like...
| Code: | std::string smd_ima_shark(HWND hwnd)
{
int len = GetWindowTextLength(hwnd) + 1;
char* str = new char[len];
GetWindowText(hwnd, str, len);
std::string butt(str);
delete[] str;
return butt;
}
//use GetDlgItem to get the control HWND if you need to.
std::string s = smd_ima_shark(COOL_HWND);
if(s.compare("some text") == 0)
{
//equal as fuck
}
//or...
if(s == "dongs")
{
//same
} |
what exactly are you trying to do?
|
|
| Back to top |
|
 |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Wed Jan 27, 2010 2:08 pm Post subject: |
|
|
| thanks , i am treing to make a bot that u can change the bot key from CB .
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jan 27, 2010 5:36 pm Post subject: |
|
|
just use a hotkey control and grab the key from that.
infinitely easier.
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Wed Jan 27, 2010 8:33 pm Post subject: |
|
|
| try strcmp()
|
|
| Back to top |
|
 |
|