Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++ - Help] compre text to text with "if" functio

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Sharel972
Newbie cheater
Reputation: 0

Joined: 02 Nov 2009
Posts: 24
Location: israel

PostPosted: Tue Jan 26, 2010 12:19 am    Post subject: [C++ - Help] compre text to text with "if" functio Reply with quote

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
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jan 26, 2010 2:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Jan 26, 2010 2:12 am    Post subject: Reply with quote

string comparison can be done with _tcsclen_s()
Back to top
View user's profile Send private message
Sharel972
Newbie cheater
Reputation: 0

Joined: 02 Nov 2009
Posts: 24
Location: israel

PostPosted: Tue Jan 26, 2010 7:10 am    Post subject: Reply with quote

Slugsnack wrote:
string comparison can be done with _tcsclen_s()

can u give me an example please?
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jan 26, 2010 7:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sharel972
Newbie cheater
Reputation: 0

Joined: 02 Nov 2009
Posts: 24
Location: israel

PostPosted: Wed Jan 27, 2010 2:08 pm    Post subject: Reply with quote

thanks , i am treing to make a bot that u can change the bot key from CB .
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Jan 27, 2010 5:36 pm    Post subject: Reply with quote

just use a hotkey control and grab the key from that.

infinitely easier.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Wed Jan 27, 2010 8:33 pm    Post subject: Reply with quote

try strcmp()
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites