| View previous topic :: View next topic |
| Author |
Message |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Sun Sep 14, 2008 9:48 am Post subject: Need help for a PostMessage loop |
|
|
Hi,
I'm working on a trainer for MapleStory and I have some trouble sending a key in a loop untill I untick the checkbox. I know how PostMessage works and how to make it bypass GG. I only have problem with sending it more than once when the checkbox is ticked. I've tried a for(; loop but the only thing that does is to freeze the trainer(not that i expected it to work) and I have searched both here and google but havn't found a solution to my problem : /. I was hoping you huys could help me so I attached the source.
|
|
| Back to top |
|
 |
Fuzz Grandmaster Cheater
Reputation: 0
Joined: 12 Nov 2006 Posts: 531
|
Posted: Sun Sep 14, 2008 10:09 am Post subject: |
|
|
You need to use threads.
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Sun Sep 14, 2008 10:25 am Post subject: |
|
|
| Fuzz wrote: | | You need to use threads. | And how do I use threads? I've tried CreateThread but don't really know how it works.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Sep 14, 2008 11:14 am Post subject: |
|
|
| TraxMate wrote: | | Fuzz wrote: | | You need to use threads. | And how do I use threads? I've tried CreateThread but don't really know how it works. |
google is your friend. So is MSDN
http://msdn.microsoft.com/en-us/library/ms682453.aspx
| Code: | | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&ProcedureNameGoesHere, hWnd, 0, 0); |
Basically this.....
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Sun Sep 14, 2008 11:50 am Post subject: |
|
|
| kitterz wrote: | | TraxMate wrote: | | Fuzz wrote: | | You need to use threads. | And how do I use threads? I've tried CreateThread but don't really know how it works. |
google is your friend. So is MSDN
http://msdn.microsoft.com/en-us/library/ms682453.aspx
| Code: | | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&ProcedureNameGoesHere, hWnd, 0, 0); |
Basically this..... |
Thank you very much . It's working now .
Edit: How do I make it stop when I untick the checkbox? CreateThread is new to me so I don't know much about it.
|
|
| Back to top |
|
 |
Fuzz Grandmaster Cheater
Reputation: 0
Joined: 12 Nov 2006 Posts: 531
|
Posted: Sun Sep 14, 2008 12:56 pm Post subject: |
|
|
TerminateThread()
_________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Sun Sep 14, 2008 2:46 pm Post subject: |
|
|
ExitThread() is preferred. When you tick the checkbox set a boolean, and have your thread compare that boolean. IF true -> ExitThread()
_________________
|
|
| Back to top |
|
 |
Fuzz Grandmaster Cheater
Reputation: 0
Joined: 12 Nov 2006 Posts: 531
|
Posted: Sun Sep 14, 2008 2:50 pm Post subject: |
|
|
Yeah, i guess ExitThread() would be better.
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Mon Sep 15, 2008 1:38 pm Post subject: |
|
|
Thank you sponge and Fuzz. You helped alot. But how do I set the delay between every keypress? i.e I write 100 in the text box and the delay should be 100 msec. I tried this | Code: | DWORD _stdcall AutoLoot()
{
LRESULT Delay = SendMessage(AutoLootDelay, WM_GETTEXT, 0, 0); // AutoLootDelay is the text box and it's preset on 100
if(MapleWnd = FindWindow(_T("MapleStoryClass"), 0))
{
for(;;)
{
_PostMessageA(MapleWnd, WM_KEYDOWN, 0x5A, (MapVirtualKey(0x5A, 0) << 16));
Sleep(Delay);
}
}
return 0;
} | And on the text box I want to get the delay time from is set on 100. It compiles perfect but it just spam the z button without a delay. I've been trying this for a couple of hours but havn't gotten it to work. I've googled for a solution but didn't find one. I know I could just write Sleep(100); instead but I want to be able to change the delay whenever I want.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Sep 15, 2008 1:43 pm Post subject: |
|
|
You're getting char's from it, not an int.
try GetDlgItemInt
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Tue Sep 16, 2008 1:51 pm Post subject: |
|
|
| LOL wtf??? I didn't even had anything related to x e n t a r's trainer in the last post :S. Just saw that now... -.-. I tried GetDlgItemInt but didn't work :/. Could you maybe give me a code snippet on how to retrieve a text from atext box?
|
|
| Back to top |
|
 |
Fuzz Grandmaster Cheater
Reputation: 0
Joined: 12 Nov 2006 Posts: 531
|
Posted: Tue Sep 16, 2008 4:48 pm Post subject: |
|
|
| slovach wrote: | You're getting char's from it, not an int.
try GetDlgItemInt |
If you'r going to do GetdlgItemInt, can you post how to use SetDlgItemInt .
And to TraxMate: Sleep(100)?
_________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Tue Sep 16, 2008 5:01 pm Post subject: |
|
|
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Wed Sep 17, 2008 2:32 am Post subject: |
|
|
| Fuzz wrote: | | slovach wrote: | You're getting char's from it, not an int.
try GetDlgItemInt |
If you'r going to do GetdlgItemInt, can you post how to use SetDlgItemInt .
And to TraxMate: Sleep(100)? |
I'm using Sleep(100); but want to be able to change the delay while using the trainer :p.
Will try that now.
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Wed Sep 17, 2008 11:45 am Post subject: |
|
|
GetDlgItemInt:
| Code: |
int Delay = GetDlgItemInt(hWnd,IDC_DELAY_EDIT,0,0);
|
hWnd - handle to your trainer
IDC_DELAY_EDIT - the Edit contol's Id
then you get the value that was entered to the edit control as int and not as string
_________________
Stylo |
|
| Back to top |
|
 |
|