| 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: Fri Sep 07, 2007 5:19 pm Post subject: SendInput question? |
|
|
Well my first question is should I use it in delphi or C++ and my second is how. For example, I found this SendInput example in C++. But theres all this other stuff too and I don't know what it is.
| Code: |
void LeftClick ( )
{
INPUT Input={0};
// left down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// left up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Chaos_Blader Newbie cheater
Reputation: 0
Joined: 07 Sep 2007 Posts: 12
|
Posted: Fri Sep 07, 2007 5:44 pm Post subject: |
|
|
| Unless you don't know C++, learn it. Then learn how to use the Windows API for simple things like Hello World. Then get into hacking. |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 07, 2007 5:48 pm Post subject: |
|
|
Lol. I know c++, if I didn't i wouldn't prolly wouldn't be asking this question. And you didn't answer either questions xP _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Sep 07, 2007 5:57 pm Post subject: |
|
|
| Code: | void LeftClick ( )
{
INPUT Input={0}; //declare Input as type INPUT
// left down
Input.type = INPUT_MOUSE; //set the type property of Input to INPUT_MOUSE
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; //same as above
::SendInput(1,&Input,sizeof(INPUT)); //send the Input
// left up
::ZeroMemory(&Input,sizeof(INPUT)); //clear Input
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP; //same as above
::SendInput(1,&Input,sizeof(INPUT)); //same as above
}
|
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Sep 07, 2007 5:58 pm Post subject: |
|
|
| You didn't ask a clear question, you just said "I don't understand this" which means you should learn C++. If you have a specific question about specific syntax search first ask later. |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Sep 07, 2007 5:59 pm Post subject: |
|
|
i think he wanted to know the syntax
i just gave it a guess
msdn is your best friend though _________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Fri Sep 07, 2007 6:00 pm Post subject: Re: SendInput question? |
|
|
| oib111 wrote: | Well my first question is should I use it in delphi or C++ and my second is how. For example, I found this SendInput example in C++. But theres all this other stuff too and I don't know what it is.
| Code: |
void LeftClick ( )
{
INPUT Input={0};
// left down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// left up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
|
|
That makes a left click!@!@!
With SendInput, you have to press a key down..then let it go (keyup).
Input.type is mouse, keyboard, etc.
Input.mi means Input.Mouse..There are other variations.. like, Input.hi for hardware input and ki for keyboard input.
The dwflags is the event that you want to happen. In this case, you want to press the mouse down in the first SendInput, then up in the second...
I don't really know what your question is..xD |
|
| Back to top |
|
 |
Programmer Cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 48
|
Posted: Fri Sep 07, 2007 6:02 pm Post subject: |
|
|
What dont you understand?
INPUT is a structure which holds info about the virtual key and other shit.
ZeroMemory is setting every member in the struct to 0
INPUT.mi = mouse input, lol
then you're using SendInput and passing your input struct as the second param, the first is the number of inputs (if Inout is an array) _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 07, 2007 6:03 pm Post subject: |
|
|
you helped the most smartz, thx. Sorry my question was what is the syntax for all the other stuf and what does each do.
Btw, where can I find a list of different input types I can use, like mi, and ki, and different events I can use, I'm looking on msdn right now. Nvm, found it.
Can I do this?
| Code: |
void PressA()
{
INPUT Input = {0};
Input.type = INPUT_KEYBOARD;
Input.wVk = VK_A;
Input.dwFlags = KEYEVENTF_KEYDOWN;
::SendInput(1, &Input, sizeof(INPUT));
::ZeroMemory(&Input, sizeof(INPUT));
Input.type = INPUT_KEYBOARD;
Input.wVk = VK_A;
Input.dwFlags = KEYEVENTF_KEYUP;
::SendInput(1, &Input, sizeof(INPUT));
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Fri Sep 07, 2007 7:02 pm Post subject: |
|
|
| oib111, don't make a function for each key press, instead make one all-purpose function where you can just pass in the virtual key code as one of the function arguments. |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Sep 07, 2007 8:24 pm Post subject: |
|
|
| That's also not the right way to use SendInput, it accepts multiple structures for a reason. |
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sat Sep 08, 2007 5:33 am Post subject: |
|
|
| Code: | void Send(unsigned short vk)
{
INPUT aInput;
memset(&aInput,0,sizeof(INPUT));
aInput.type = INPUT_KEYBOARD;
aInput.ki.wVk = vk;
aInput.ki.dwFlags = 0;
SendInput(1,&aInput,sizeof(INPUT));
aInput.type = INPUT_KEYBOARD;
aInput.ki.wVk = vk;
aInput.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1,&aInput,sizeof(INPUT));
} |
You can use that...then just put something like, VK_A in the parameters.
E.G.
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Sep 08, 2007 10:22 am Post subject: |
|
|
Thx smartz _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sat Sep 08, 2007 10:53 am Post subject: |
|
|
| Np..and i think im gonna start making my forum more active, so go there and there will be more stuff. |
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Sep 09, 2007 9:35 am Post subject: |
|
|
| Doing it in delphi would be a piece of cake, but C++ is more usfull and I bet would be A LOT faster than delphi, altough you can make it faster in delphi too, but also in C++, so it would be really fast! |
|
| Back to top |
|
 |
|