furmiga
asked on
Force key imput on a DXInput program
I was trying to press a key using keybd_event on a program using DXInput than i discoreverd that this method wont work. Here what i am trying to do:
I made program that read one memory value from another program. When this value is X the program press a key that, on the main program, provides a determined action who change the value memory again. But the main program is a game and it runs DXInput. Well... i cant use keybd_event on my program cuz it wont work for DXInput so this is the question : Does anyone knows how my program can press one key to the mais program ( who uses DXInput ) undestand the command ? ( Remember, the main program is aways running in full screnn ).
This is the OnTimer Event ( Maybe it heps.... )
procedure TForm1.Timer1Timer(Sender: TObject);
var
ready : cardinal;
pi : ^integer;
i1 : integer;
begin
GetMem(buf,4);
If ReadProcessMemory(HandleWi ndow,ptr($ 5D461C),bu f,4,ready) then
begin end;
pi:=buf;
i1:=pi^;
//edit1.Text := inttostr(i1);
FreeMem(buf);
if i1 < 110 then
begin
beep;
keybd_event( Ord('1'), MapvirtualKey( Ord('1'), 0), 0, 0 );
end;
end;
Thx guys...
I made program that read one memory value from another program. When this value is X the program press a key that, on the main program, provides a determined action who change the value memory again. But the main program is a game and it runs DXInput. Well... i cant use keybd_event on my program cuz it wont work for DXInput so this is the question : Does anyone knows how my program can press one key to the mais program ( who uses DXInput ) undestand the command ? ( Remember, the main program is aways running in full screnn ).
This is the OnTimer Event ( Maybe it heps.... )
procedure TForm1.Timer1Timer(Sender:
var
ready : cardinal;
pi : ^integer;
i1 : integer;
begin
GetMem(buf,4);
If ReadProcessMemory(HandleWi
begin end;
pi:=buf;
i1:=pi^;
//edit1.Text := inttostr(i1);
FreeMem(buf);
if i1 < 110 then
begin
beep;
keybd_event( Ord('1'), MapvirtualKey( Ord('1'), 0), 0, 0 );
end;
end;
Thx guys...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DirectX goes down to very low level hardware, probably below even the keybd_event level. DX also doesn't receive messages in the normal way so I suspect this may be a lost cause.
Geoff M.
Geoff M.
ASKER
gmayo i hope.... i really hope that u r wrong :) If not, omg....
Well, maybe another instance of DXInput can self activate the key. Since i am on the main program what this action can make ? I mean if my program, using DXInput, can activate the key for the main program. Is it possible ? Damn i am getting crazy.....
Thx guys
Well, maybe another instance of DXInput can self activate the key. Since i am on the main program what this action can make ? I mean if my program, using DXInput, can activate the key for the main program. Is it possible ? Damn i am getting crazy.....
Thx guys
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I did wonder about opening your own DirectInput but would it work in parallel with the other app? Because normally one app would "own" the device at a time - switch focus from one app to the other and the new app now "owns" it temporarily.
I just did a search on Google for DirectInput and keybd_event - Robert, you get around a bit, don't you! ;-) So at least I was right, on Win9x systems anyway.
Geoff M.
I just did a search on Google for DirectInput and keybd_event - Robert, you get around a bit, don't you! ;-) So at least I was right, on Win9x systems anyway.
Geoff M.
ASKER