| View previous topic :: View next topic |
| Author |
Message |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat Jan 19, 2008 11:21 pm Post subject: Delphi sending keys using virtual keys |
|
|
I am using delphi to send keys using virtual keys but i need some help
Im using a text box to take a single character from and convert the letter or number to a virtual key so it can then be sent individually, but i cant seem to get it to work properly
this is what i got so far
| Code: |
i : integer;
CharScan : integer;
TempChar : Char;
for i := 1 to Length(EditText.text) do
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar); |
But this doesn't seem to work, im using hookhop.dll to send it
i'm doing it like this
| Code: | | hhPostMessageA(h,WM_KeyDown,CharScan,0); |
Im trying to figure out how i can get this all to work together
Any help appreciated!
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sun Jan 20, 2008 2:44 am Post subject: |
|
|
Because you use a char for a string and you loop only on the first line (TempChar := Char(...)
for ... to ... do beign
tempchar := ....;
charscan := ....;
postmessage(...);
end;
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jan 20, 2008 3:50 am Post subject: |
|
|
so i need begin and end after for...do
like this?
| Code: | for i := 1 to Length(EditText.text) do
begin
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar);
if h<>0 then
begin
hhPostMessageA(h,WM_KeyDown,CharScan,0);
end;
end; |
the full code is
| Code: | var
h:hwnd;
i : integer;
Name : String;
DaName : PChar;
CharScan : integer;
TempChar : Char;
begin
Name := EditTitle.Text;
DaName := PCHAR(Name);
h:=FindWindowA(nil,DaName);
for i := 1 to Length(EditText.text) do
begin
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar);
if h<>0 then
begin
hhPostMessageA(h,WM_KeyDown,CharScan,0);
end;
end;
end; |
is it looking good?
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Sun Jan 20, 2008 7:27 am Post subject: |
|
|
| AdamG62 wrote: | so i need begin and end after for...do
like this?
| Code: | for i := 1 to Length(EditText.text) do
begin
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar);
if h<>0 then
begin
hhPostMessageA(h,WM_KeyDown,CharScan,0);
end;
end; |
the full code is
| Code: | var
h:hwnd;
i : integer;
Name : String;
DaName : PChar;
CharScan : integer;
TempChar : Char;
begin
Name := EditTitle.Text;
DaName := PCHAR(Name);
h:=FindWindowA(nil,DaName);
for i := 1 to Length(EditText.text) do
begin
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar);
if h<>0 then
begin
hhPostMessageA(h,WM_KeyDown,CharScan,0);
end;
end;
end; |
is it looking good? |
For a non delphi coder it looks understandable.
Maby i should learn delphi.
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jan 20, 2008 8:25 am Post subject: |
|
|
| maybe, it's not very hard
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Sun Jan 20, 2008 8:42 am Post subject: |
|
|
| AdamG62 wrote: | so i need begin and end after for...do
...
the full code is
| Code: | var
h:hwnd;
i : integer;
Name : String;
DaName : PChar;
CharScan : integer;
TempChar : Char;
begin
Name := EditTitle.Text;
DaName := PCHAR(Name);
h:=FindWindowA(nil,DaName);
for i := 1 to Length(EditText.text) do
begin
TempChar := Char(EditText.text[i]);
CharScan := VkKeyScan(TempChar);
if h<>0 then
begin
hhPostMessageA(h,WM_KeyDown,CharScan,0);
end;
end;
end; |
is it looking good? |
I think it will work, but remember to use WM_KeyUP.
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sun Jan 20, 2008 9:46 am Post subject: |
|
|
i still doesn't seem to work
to test the postmessage function i was doing it like this
| Code: | | hhPostMessageA(h,WM_KeyUp,$70,0); |
its really hard to figure out where its not working if i cant even tell if any of it works
|
|
| Back to top |
|
 |
|