| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Jun 07, 2008 1:06 pm Post subject: |
|
|
| Code: |
#define IDC_HOTKEY1 100
#define IDC_HOTKEY2 101
#define IDC_HOTKEY3 102
//other coding
case WM_CREATE:
RegisterHotKey(hWnd, IDC_HOTKEY1, NULL, 0x71);
RegisterHotKey(hWnd, IDC_HOTKEY2, NULL, 0x72);
RegisterHotKey(hWnd, IDC_HOTKEY3, NULL, 0x73);
break;
case WM_HOTKEY:
if(IDC_HOTKEY1) {
//your code here
}
if(IDC_HOTKEY2) {
//your code here
}
if(IDC_HOTKEY3) {
//your code here
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sat Jun 07, 2008 1:10 pm Post subject: |
|
|
now whenever i click f2,f3,f4 it's turns on/off all of them in once
and wiccaan it's not the x's it was my tiping mistake :s
Edit: fixed it nvm all i needed to do is put it inside a switch block
| Code: |
switch (LOWORD(wParam))
case IDC_HOTKEY1:
// etc
|
_________________
Stylo |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Sat Jun 07, 2008 2:28 pm Post subject: |
|
|
Make sure you put in breaks if you are using cases.
| Code: | case IDC_HOTKEY_1:
// code
break;
case IDC_HOTKEY_2:
// code
break; |
And so on. _________________
- Retired. |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Sat Jun 07, 2008 4:28 pm Post subject: |
|
|
About the mov edi, edi stuff.
They're the prologue to functions with __stdcall.
mov edi, edi: dereference edi pointer
push ebp: saves stack pointer
mov ebp, esp: creates a stack frame for the function
If you notice, at the end of the function, the is a sub esp, xxx. xxx is how many bytes of stack the function uses. Followed by a pop ebp. Then a ret. That's so the function can use its own stack frames and restore the original stack when returning to the caller. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 08, 2008 12:20 am Post subject: |
|
|
i'm having problem with my AC
here's the auto clicker thread:
| Code: |
void AutoClick()
{
LoadUser32();
bClk = TRUE;
while (bClk)
{
POINT pt;
GetCursorPosX(&pt);
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, (LPARAM)&pt);
PostMessageX(hMS, WM_LBUTTONUP, MK_LBUTTON, (LPARAM)&pt);
Sleep(10);
}
ExitThread(0);
}
|
when i turn it on it crushes i think the problem is in the GetCursorPos function which i bypassed too like postMessage
and when i send mouse clicks without the POINT (with NULL value)
it works but clicks at the left top corner of the screen _________________
Stylo |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Sun Jun 08, 2008 12:33 am Post subject: |
|
|
WM_LBUTTONDOWN uses a word value for it's coords, not a point.
http://msdn.microsoft.com/en-us/library/ms645607(VS.85).aspx
| Quote: | lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. |
Use the MAKELPARAM macro instead to accomplish what you need:
| Code: | | PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, (LPARAM)MAKELPARAM( pt.x, pt.y )); |
_________________
- Retired. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 08, 2008 12:38 am Post subject: |
|
|
but it still crushes cuz of the GetCursorPos function
i bypassed it like i did to PostMessage _________________
Stylo |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
Posted: Sun Jun 08, 2008 12:39 am Post subject: |
|
|
| 1qaz wrote: | but it still crushes cuz of the GetCursorPos function
i bypassed it like i did to PostMessage |
If GetCusorPos is causing the crash then post the code for that. Can't really help without seeing what may be causing it to crash. _________________
- Retired. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 08, 2008 12:42 am Post subject: |
|
|
it's exactly like postMessage
here:
| Code: |
void LoadUser32GetCurPos()
{
hgcInst = LoadLibrary(L"User32.Dll");
gcDLLFunc = NULL;
if (hgcInst != NULL)
gcDLLFunc = (DWORD)GetProcAddress(hgcInst,"GetCursorPos");
if (gcDLLFunc != NULL)
gcDLLFunc += 5;
}
__declspec(naked) BOOL WINAPI GetCursorPosX(LPPOINT pt)
{
__asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp dword ptr ds:[gcDLLFunc]
}
}
|
_________________
Stylo |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Jun 08, 2008 2:30 am Post subject: |
|
|
| You don't have to bypass GetCursorPos... its not hooked. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 3:37 am Post subject: |
|
|
Shouldn't you call LoadUser32GetCursPos and LoadUser32 in your AC function? Oh w8, you load the library in there too. Ok take out this line of code:
| Code: |
//in LoadUsesr32GetCursPos()
hgcInst = LoadLibrary(L"User32.Dll"); //don't want to load the same library twice
|
And then chance your code to this:
| Code: |
void AutoClick()
{
LoadUser32();
LoadUser32GetCursPos();
bClk = TRUE;
while (bClk)
{
POINT pt;
GetCursorPosX(&pt);
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, (LPARAM)MAKELPARAM( pt.x, pt.y ));
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, (LPARAM)MAKELPARAM( pt.x, pt.y ));
Sleep(10);
}
ExitThread(0);
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 08, 2008 3:53 am Post subject: |
|
|
Jumping up and down a few pixels, and can't click on characters...Not sure, but it could be the typecast. If you look in winuser.h where MAKELPARAM is defined...
| Code: |
#define MAKELPARAM(l, h) ((LPARAM) MAKELONG(l, h))
|
It already returns it as an LPARAM:
#define MAKELPARAM(l, h) ((LPARAM) MAKELONG(l, h))
So try taking out the typecast. So change it to:
| Code: |
void AutoClick()
{
LoadUser32();
LoadUser32GetCursPos();
bClk = TRUE;
while (bClk)
{
POINT pt;
GetCursorPosX(&pt);
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( pt.x, pt.y ));
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( pt.x, pt.y ));
Sleep(10);
}
ExitThread(0);
}
|
EDIT:
Oh yeah, it could be you trying to restore the initial five bytes in GetCursPos. Because it's not actually hooked by GG, so the whole "GetCursPosX" thing isn't necessary. Try taking out this whole part:
| Code: |
void LoadUser32GetCurPos()
{
hgcInst = LoadLibrary(L"User32.Dll");
gcDLLFunc = NULL;
if (hgcInst != NULL)
gcDLLFunc = (DWORD)GetProcAddress(hgcInst,"GetCursorPos");
if (gcDLLFunc != NULL)
gcDLLFunc += 5;
}
__declspec(naked) BOOL WINAPI GetCursorPosX(LPPOINT pt)
{
__asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp dword ptr ds:[gcDLLFunc]
}
}
|
And then change your AC function to:
| Code: |
void AutoClick()
{
LoadUser32();
bClk = TRUE;
while (bClk)
{
POINT pt;
GetCursorPos(&pt);
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( pt.x, pt.y ));
PostMessageX(hMS, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM( pt.x, pt.y ));
Sleep(10);
}
ExitThread(0);
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Sun Jun 08, 2008 4:01 am Post subject: |
|
|
not helping but hey i dont think that's that matter most of Autoclickers for ms doing that (i think xD) i'll keep working on that thx. _________________
Stylo |
|
| Back to top |
|
 |
|