» Utilizator
Salut, vizitatorule!

SkullBox este o comunitate formata din programatori si administratori de sisteme sau retele care iti sta la dispozitie cand ai o problema legata de calculatoare. Daca esti un utilizator existent, autentifica-te.

Daca nu te-ai inregistrat inca pe forum, alatura-te noua astfel marind comunitatea si ajutandu-i pe cei care au nevoie de informatii.

Daca te-ai inregistrat dar inca nu ai primit codul de activare, il poti cere aici.




Autentifica-te cu numele de utilizator si parola pentru a putea posta pe forum sau pentru a accesa ariile disponibile doar utilizatorilor inregistrati.
» Promovam
» Parteneri » Statistici
  • 59734 de mesaje.
  • 7149 de topicuri.
  • 1005 de utilizatori.
  •  
  • Usellexelty e ultimul utilizator inregistrat.
[Detalii]

 
Pagini: [1]
Print
Simulare taste [Delphi] [1042 afisari]
DarkByte
*


Mesaje: 3333
OfflineOffline

WWW

Mentionez ca acest cod nu este facut de mine, eu am facut doar niste modificari pentru cazurile in care trebuie si Shift apasat.

Code:
procedure SendKeys(WinHandle:Hwnd;Buffer:String);
var I: Integer;
    W: Word;
    D: DWORD;
    P: ^DWORD;
begin
  P:=@D;
  SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,P,0);
  if IsIconic(WinHandle) then
    ShowWindow(WinHandle,SW_RESTORE);
  SetForegroundWindow(WinHandle);
  For I := 1 to Length(Buffer) do begin
    W:=VkKeyScan(Buffer[i]);
    if (Hi(w) and 1 = 1) then
      keybd_event(VK_SHIFT,1,0,0);
    keybd_event(w,0,0,0);
    keybd_event(w,0,KEYEVENTF_KEYUP,0);
    if (Hi(w) and 1 = 1) then
      keybd_event(VK_SHIFT,1,KEYEVENTF_KEYUP,0);
                                  end;
  SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,nil,0);
  SetForegroundWindow(WinHandle);
  SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,D,nil,0);
end;
Practic, doar alegeti fereastra (ca handle) in care vreti sa "scrieti" si ii dati ce text sa scrie.

Exemplu:
Code:
SendKeys(Notepad_handle, 'simulated text');
Logged

Document my code? Why do you think it's called "code"?

To think is to differ - Clarence Darrow
06-06-2008, 20:21 Twitt ::
Reclama
VIP

Hosting

Mesaje: 25.90
OnlineOnline

WWW
 

   Pe ABCDomenii: 250MB spatiu + 20GB trafic + 5 subdomenii = 0.95 €
 
 

The problem with troubleshooting is that trouble shoots back.
Azi 
Pages: [1]
Print
SkullBox Forum  |  Development  |  Delphi & Pascal  |  Pascal / Delphi Snippets  |  Topic: Simulare taste [Delphi]
Jump to: