amigos estou com um problema preciso simular um pressionamento de tecla com o harbour similar a este codigo aqui
https://batchloaf.wordpress.com/2012/04/17/simulating-a-keystroke-in-win32-c-or-c-using-sendinput/
tem algo no harbour igual?

Moderador: Moderadores
For P = 1 to Len(aNotas)
VAR&XX = aNotas[P,1]
Keyboard { VAR&XX, 13 } // <--- Equivale a variable mas enter en el get
@ 11, 12 SAY "FOLIO &XX"
@ 11, 23 Get VAR&XX PICT "@!S8" VALID Empty(VAR&XX)
READ
IF LASTKEY() = 27
EXIT
ENDIF
Next
KEYBOARD
Writes a string or numeric key codes into the keyboard buffer.
Syntax
KEYBOARD <cString>
KEYBOARD <nInkeyCode>
KEYBOARD <aKeyCodes>
Arguments
<cString>
This is the character string that is written into the keyboard buffer.
<nInkeyCode>
Alternatively, a numeric key code can be specified. Normally, the #define constants listed in the Inkey.ch files are used for <nInkeyCode>.
<aKeyCodes>
A mixture of character strings or numeric key codes can be specified as a one dimensional array.
Description
The KEYBOARD command first clears the keyboard buffer and then fills it with the key codes specified as character strin, numeric values or within an array. Thus, all pending key strokes are discarded before new characters are written into the keyboard buffer. They remain in the buffer until being fetched from it during a wait state in which the keyboard buffer is polled for the next key stroke.
Wait states are employed by functions and commands that wait for user input, such as Achoice(), READ or MemoEdit().
Paredes01 Hola.
En modo consolai
por Pablo César
Seria para modo console ou GUI ?
JoséQuintas
Sei lá, tô achando fácil demais pra ter dúvida..... rs
//
// keystroke.c - Pauses, then simulates a key press
// and release of the "A" key.
//
// Written by Ted Burke - last updated 17-4-2012
//
// To compile with MinGW:
//
// gcc -o keystroke.exe keystroke.c
//
// To run the program:
//
// keystroke.exe
//
// ...then switch to e.g. a Notepad window and wait
// 5 seconds for the A key to be magically pressed.
//
// Because the SendInput function is only supported in
// Windows 2000 and later, WINVER needs to be set as
// follows so that SendInput gets defined when windows.h
// is included below.
// compilar normal hbmk2 tecla.prg
// 2 cliques sobre o .exe gerado ai abra o bloco de notas vai ver que vai ficar inserindo o "a" a cada 1 segundo
procedure main()
while .t.
_keyb()
end
#pragma BEGINDUMP
#define WINVER 0x0500
#include <windows.h>
#include <hbapi.h>
HB_FUNC(_KEYB)
{
// This structure will be used to create the keyboard
// input event.
INPUT ip;
// Pause for 1 seconds.
Sleep(1000);
// Set up a generic keyboard event.
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0; // hardware scan code for key
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
// Press the "A" key
ip.ki.wVk = 0x41; // virtual-key code for the "a" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
// Release the "A" key
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &ip, sizeof(INPUT));
// Exit normally
hb_retnl(1);
}
#pragma ENDDUMP
Usuários vendo este fórum: clodoaldomonteiro e 6 visitantes