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 


SendInput question?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
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?

PostPosted: Fri Sep 07, 2007 5:19 pm    Post subject: SendInput question? Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Chaos_Blader
Newbie cheater
Reputation: 0

Joined: 07 Sep 2007
Posts: 12

PostPosted: Fri Sep 07, 2007 5:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 07, 2007 5:48 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Sep 07, 2007 5:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 07, 2007 5:58 pm    Post subject: Reply with quote

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

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Sep 07, 2007 5:59 pm    Post subject: Reply with quote

i think he wanted to know the syntax

i just gave it a guess Confused

msdn is your best friend though

_________________
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Fri Sep 07, 2007 6:00 pm    Post subject: Re: SendInput question? Reply with quote

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!@!@! Very Happy

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
View user's profile Send private message
Programmer
Cheater
Reputation: 0

Joined: 02 Sep 2007
Posts: 48

PostPosted: Fri Sep 07, 2007 6:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Fri Sep 07, 2007 6:03 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Fri Sep 07, 2007 7:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Sep 07, 2007 8:24 pm    Post subject: Reply with quote

That's also not the right way to use SendInput, it accepts multiple structures for a reason.
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Sat Sep 08, 2007 5:33 am    Post subject: Reply with quote

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.
Code:

Send(VK_A);
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Sep 08, 2007 10:22 am    Post subject: Reply with quote

Thx smartz
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Sat Sep 08, 2007 10:53 am    Post subject: Reply with quote

Np..and i think im gonna start making my forum more active, so go there and there will be more stuff.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Sep 09, 2007 9:35 am    Post subject: Reply with quote

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
View user's profile Send private message
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