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 


Delphi(Sending KeyStrokes)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Thu Jun 28, 2007 10:36 am    Post subject: Delphi(Sending KeyStrokes) Reply with quote

Would anyone happen to know how to send Keystrokes to another application using delphi.
i have a Command but it doesnt seem to work.
Thanks.

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu Jun 28, 2007 10:37 am    Post subject: Reply with quote

It's not going to work if you're trying this on a protected program like MapleStory.
Back to top
View user's profile Send private message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Thu Jun 28, 2007 1:50 pm    Post subject: Reply with quote

Im not using it for Maple.Im not dumb enough to try making a simple Key Sendstorke for maple lol.
Maple Easily detects.

But do you have the command?

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
Splizes
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Jun 2006
Posts: 1944
Location: Florida

PostPosted: Thu Jun 28, 2007 1:57 pm    Post subject: Reply with quote

Umm
Appactivate('firefox');
SendKeys('i rule', True) ;


I dont know delphi so this would work if delphi is anything like simple vb >.>
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Thu Jun 28, 2007 3:24 pm    Post subject: Reply with quote

SnowFox, that just simulates the keypresses, he wants to send it to the application.
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Thu Jun 28, 2007 4:46 pm    Post subject: Reply with quote

Findwindow/findwindowex
postmessaage/sendmessage.

_________________
Back to top
View user's profile Send private message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Thu Jun 28, 2007 7:35 pm    Post subject: Reply with quote

Thanks guys.

I tried using this but it wont work for some reason

Code:

 keybd_event(vk_control, 1,0,0);
 keybd_event(vk_F6, 1,0,0);
 keybd_event(vk_F6, 1,keyeventf_keyup,0);
 keybd_event(vk_control, 1,keyeventf_keyup,0);

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Fri Jun 29, 2007 2:42 am    Post subject: Reply with quote

*Not my work*

Heres some methods of input you can play around with. Wink


Code:
  const
{$EXTERNALSYM INPUT_MOUSE}
INPUT_MOUSE = 0;
{$EXTERNALSYM INPUT_KEYBOARD}
INPUT_KEYBOARD = 1;
{$EXTERNALSYM INPUT_HARDWARE}
INPUT_HARDWARE = 2;

type
PInput = ^TInput;
{$EXTERNALSYM tagINPUT}
tagINPUT = packed record
   Itype: DWORD;
   case Integer of
     0: (mi: TMouseInput);
     1: (ki: TKeybdInput);
     2: (hi: THardwareInput);
end;
TInput      =  tagINPUT;
TInputArray =  Array [0..Pred(MaxInt div SizeOf(tagInput))] of TInput;
PInputArray =  ^TInputArray;

function SendInput(cInputs: UINT; lpInputs: PInputArray; cbSize: Integer): UINT; stdcall; external 'user32.dll';

implementation

{$R *.dfm}

procedure PostKeyEx32(key: Word; const shift: TShiftState; specialkey: Boolean) ;
{
Parameters :
* key : virtual keycode of the key to send. For printable keys this is simply the ANSI code (Ord(character)) .
* shift : state of the modifier keys. This is a set, so you can set several of these keys (shift, control, alt, mouse buttons) in tandem. The TShiftState type is declared in the Classes Unit.
* specialkey: normally this should be False. Set it to True to specify a key on the numeric keypad, for example.

Description:
Uses keybd_event to manufacture a series of key events matching the passed parameters. }
type
   TShiftKeyInfo = record
     shift: Byte ;
     vkey: Byte ;
   end;
   ByteSet = set of 0..7 ;
const
   shiftkeys: array [1..3] of TShiftKeyInfo =
     ((shift: Ord(ssCtrl) ; vkey: VK_CONTROL),
     (shift: Ord(ssShift) ; vkey: VK_SHIFT),
     (shift: Ord(ssAlt) ; vkey: VK_MENU)) ;
var
   flag: DWORD;
   bShift: ByteSet absolute shift;
   j: Integer;
begin
   for j := 1 to 3 do
   begin
     if shiftkeys[j].shift in bShift then
       keybd_event(shiftkeys[j].vkey, MapVirtualKey(shiftkeys[j].vkey, 0), 0, 0) ;
   end;
   if specialkey then
     flag := KEYEVENTF_EXTENDEDKEY
   else
     flag := 0;

   keybd_event(key, MapvirtualKey(key, 0), flag, 0) ;
   flag := flag or KEYEVENTF_KEYUP;
   keybd_event(key, MapvirtualKey(key, 0), flag, 0) ;

   for j := 3 downto 1 do
   begin
     if shiftkeys[j].shift in bShift then
       keybd_event(shiftkeys[j].vkey, MapVirtualKey(shiftkeys[j].vkey, 0), KEYEVENTF_KEYUP, 0) ;
   end;
end;

function InsertTextInput(S: String): Boolean;
var  lpiaKeys:   PInputArray;
    lpszText:   PChar;
    nInputs:    LongWord;
    key:        Short;
    i:          Integer;
begin

// Set default result
result:=False;

// Exit if nothing to send
if (S = '') then exit;

// Allocate memory for keys strokes (4x the number of chars, due to shift
// injection and key down/up handling)
nInputs:=Length(S) * 4;
lpiaKeys:=AllocMem(Length(S) * nInputs);

// Convert the text stream into keystrokes
i:=0;
lpszText:=PChar(S);
while (lpszText^ > #0) do
begin

    // Check for CR or LF
    if (lpszText^ = #13) or (lpszText^ = #10) then
    begin
       // Push past CR
       if (lpszText^ = #13) then Inc(lpszText);
       // Check for LF (this will handle single LF with no CR)
       if (lpszText^ = #10) then
       begin
          // Push past LF
          Inc(lpszText);
          // Inject the VK_RETURN
          lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
          lpiaKeys^[i].ki.wVk:=VK_RETURN;
          Inc(i);
          lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
          lpiaKeys^[i].ki.wVk:=VK_RETURN;
          lpiaKeys^[i].ki.dwFlags:=KEYEVENTF_KEYUP;
          Inc(i);
       end;
       // Continue with the main loop
       Continue;
    end;

    // Convert to virtual key
    key:=VkKeyScan(lpszText^);
    Inc(lpszText);

    // Is the shift set?
    if (Hi(key) > 0) then
    begin
       // Shift key down
       lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
       lpiaKeys^[i].ki.wVk:=VK_SHIFT;
       Inc(i);
    end;

    // Key down
    lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
    lpiaKeys^[i].ki.wVk:=Lo(key);
    Inc(i);

    // Key up
    lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
    lpiaKeys^[i].ki.wVk:=Lo(key);
    lpiaKeys^[i].ki.dwFlags:=KEYEVENTF_KEYUP;
    Inc(i);

    // Shift key set?
    if (Hi(key) > 0) then
    begin
       // Shift key up
       lpiaKeys^[i].Itype:=INPUT_KEYBOARD;
       lpiaKeys^[i].ki.wVk:=VK_SHIFT;
       lpiaKeys^[i].ki.dwFlags:=KEYEVENTF_KEYUP;
       Inc(i);
    end;

end;

// Send the keys
result:=(SendInput(i, lpiaKeys, SizeOf(TInput)) = i);

// Free the memory
FreeMem(lpiaKeys);

end;
Back to top
View user's profile Send private message
ZenX
Grandmaster Cheater Supreme
Reputation: 1

Joined: 26 May 2007
Posts: 1021
Location: ">>Pointer<<" : Address 00400560 Offset :1FE

PostPosted: Fri Jun 29, 2007 11:29 am    Post subject: Reply with quote

Thanks compact Water.This helps me a bunch with my project.
But it seem's much easier to do in VB(My project Lol).
but yeah, thanks, ill try this out and let you knwo what happens.
+ Rep

_________________
CEF Moderator since 2007 ^_^
ZenX-Engine
Back to top
View user's profile Send private message Yahoo Messenger
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