 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Sun Dec 06, 2009 10:04 am Post subject: [Help C++] |
|
|
I need help comparing of text into Combobox
for example:
| Code: |
// AutoSkill
void AutoSkill (HWND hWnd)
{
LPARAM lparamZ = (MapVirtualKey(0x05A, 0) << 16) + 1; //Send to graphic screen
LPARAM lparamQ = (MapVirtualKey(0x051, 0) << 16) + 1; //Send to graphic screen
HWND MSHWND = FindWindow ("Game",0); //Find class window
SendMessage (GetDlgItem(hWnd, IDC_CHECKBOX1), BM_SETCHECK, true,0);
while (!AutoSkillExit)
{
[b] if(GetDlgItemText(hWnd,IDC_COMBO1,FALSE,244) = "Z")[/b]
PM(MSHWND, WM_KEYDOWN, 0x05A, lparamZ); //Send "Z" Key
PM(MSHWND, WM_KEYUP, 0x05A, NULL);
Sleep (1000);
}
{
[b] else(GetDlgItemText(hWnd,IDC_COMBO1,FALSE,244) = "Q")[/b]
PM(MSHWND, WM_KEYDOWN, 0x051, lparamQ); //Send "Q" Key
PM(MSHWND, WM_KEYUP, 0x051, NULL);
Sleep (1000);
}
SendMessage (GetDlgItem(hWnd, IDC_CHECKBOX1), BM_SETCHECK, false,0);
} |
how do i do that?
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Dec 06, 2009 11:59 am Post subject: |
|
|
Well, for one, your using GetDlgItemText completely wrong.
| Code: | UINT GetDlgItemText(
HWND hDlg,
int nIDDlgItem,
LPTSTR lpString,
int nMaxCount
); |
The return of this function is the number of characters copied into the lpString parameter.
The lpString parameter is the pointer to which a string will be copied too.
Also, judging by the IDC_COMBO1, your using a combo box? Therefore to get the text from the selected item you must the 3 messages: CB_GETLBTEXT, CB_GETLBTEXTLEN and CB_GETCURSEL.
Also your approach for changing keys to be sent is inefficiant, you should check the text, filter it and set a variable to hold the key being sent.
Anyways, in your approach it should look like this:
| Code: | LPTSTR lpszString;
INT nCurSel;
nCurSel = SendDlgItemMessage(hWnd, IDC_COMBO1, CB_GETCURSEL, 0, 0);
if (nCurSel != -1)
{
lpszString = (LPTSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TCHAR)*(SendDlgItemMessage(hWnd, IDC_COMBO1, CB_GETLBTEXTLEN, nCurSel, 0) + 1)); // Plus null terminating char.
if (lpszString != NULL)
{
if (SendDlgItemMessage(hWnd, IDC_COMBO1, CB_GETLBTEXT, nCurSel, lpszString) > 0) // Make sure it copies the string
{
while (!AutoSkillExit)
{
if (lstrcmpi(lpszString, _T("Z")) == 0)
{
// .. PM
}
// .. ETC.
}
}
HeapFree(GetProcessHeap(), 0, (LPVOID)lpszString);
}
} |
_________________
|
|
| Back to top |
|
 |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Sun Dec 06, 2009 1:29 pm Post subject: |
|
|
i didn't succeed , can u try to help and build the script or something...
I try to allow people to choose the keys of the bot from combobox.
|
|
| Back to top |
|
 |
|
|
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
|
|