Hello man, your help was pretty good. I tried using the following code and it worked almost awesome.
The problem is that it always overwrite the last letter, so i put the keybd_event(37, 0, 0, 0); but with this it puts the cursor to back. But it works not in a properly way, but it is ... So do you know how i could fix it and make the cursor work properly as in the " windows virtual keyboard " ??? By the way the code bellow is fully functional and u can test there.
thanks for any information.
- Code: Select all
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
MyHandle : THandle;
//Ax : THandle;
HandleMaeFocus : THandle;
HandleFilhaFocus : THandle;
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
//============================================================================//
procedure TForm2.Button1Click(Sender: TObject);
//============================================================================//
begin
Application.HandleMessage;
//Handle da janela do teclado
MyHandle := FindWindow('TForm2',nil);
if GetActiveWindow = MyHandle then
HandleMaeFocus := GetNextWindow(MyHandle,GW_HWNDNEXT);
Sendmessage(HandleFilhaFocus,WM_SETFOCUS,0,0);
SetActiveWindow(HandleFilhaFocus);
//Caso esteja digitando no browser HERE ---------<<<<<<<<<---////
keybd_event(37, 0, 0, 0);
//Código ascii da letter A
keybd_event(65, 0, 0, 0);
end;
end.