HB_FUNC( SENDKEY )
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = hb_parnl( 1 );
input.ki.wScan = 0;
input.ki.dwFlags = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
hb_retnl( SendInput( 1, &input, sizeof( input ) ) );
}
@03,01 BUTTON oBtn_A ACTION PostMessage( oGet1:hWnd, WM_CHAR, 65, 0 ) // Puts A on oGet1
@04,01 BUTTON oBtn_B ACTION PostMessage( oGet2:hWnd, WM_CHAR, 66, 0 ) // Puts B on oGet2
#include "FiveWin.ch"
//-----------------------//
Function Main()
Local oDlg,oGet,cVar:=Space(30),oBtn1,oBtn2,oBtn3,oBtn4
DEFINE DIALOG oDlg TITLE "Test"
@01,01 GET oGet VAR cVar SIZE 100,12
@03,01 BUTTON oBtn1 PROMPT "1" SIZE 10,10 ACTION (PostMessage( oGet:hWnd, WM_CHAR, 49, 0 ),oGet:Refresh())
@03,03 BUTTON oBtn2 PROMPT "2" SIZE 10,10 ACTION (PostMessage( oGet:hWnd, WM_CHAR, 50, 0 ),oGet:Refresh())
@03,05 BUTTON oBtn3 PROMPT "3" SIZE 10,10 ACTION (PostMessage( oGet:hWnd, WM_CHAR, 51, 0 ),oGet:Refresh())
@03,07 BUTTON oBtn4 PROMPT "4" SIZE 10,10 ACTION (PostMessage( oGet:hWnd, WM_CHAR, 52, 0 ),oGet:Refresh())
ACTIVATE DIALOG oDlg
Return nil
#pragma BEGINDUMP
#include "winuser.h"
#include "windows.h"
HB_FUNC( SENDKEY )
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = hb_parnl( 1 );
input.ki.wScan = 0;
input.ki.dwFlags = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
hb_retnl( SendInput( 1, &input, sizeof( input ) ) );
}
#pragma ENDDUMP
....
....
ACTION tecla('D',oget)
....
....
ACTION (oGet:SetFocus(), sysRefresh(), oGet:KeyDown(VK_HOME))
...
....
FUNCTION Tecla(letra,oget)
oGet:SetFocus()
SysreFresh()
oGet:KeyChar(ASC(letra))
oGet:Refresh()
RETURN NIL
#ifndef INPUT_MOUSE
#define INPUT_MOUSE 0
#define INPUT_KEYBOARD 1
#define INPUT_HARDWARE 2
typedef struct tagMOUSEINPUT {
LONG dx;
LONG dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} MOUSEINPUT, *PMOUSEINPUT, FAR* LPMOUSEINPUT;
typedef struct tagKEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT, FAR* LPKEYBDINPUT;
typedef struct tagHARDWAREINPUT {
DWORD uMsg;
WORD wParamL;
WORD wParamH;
} HARDWAREINPUT, *PHARDWAREINPUT, FAR* LPHARDWAREINPUT;
typedef struct tagINPUT {
DWORD type;
union
{
MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
};
} INPUT, *PINPUT, FAR* LPINPUT;
#endif
HB_FUNC( SENDKEY )
{
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = hb_parnl( 1 );
input.ki.wScan = 0;
input.ki.dwFlags = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
hb_retnl( SendInput( 1, &input, sizeof( input ) ) );
}
redefine get oGetCantidad var nCantidad picture " 9999.99 €" id 202 of odlg FONT oFonts:oFontTextoNegritaExtraGrande ON CHANGE (nDevolucion:=oThis:nTotalVenta - val(cValtoChar(nCantidad)),oGetDevolucion:refresh()) valid (nDevolucion:=oThis:nTotalVenta - val(cValtoChar(nCantidad)) - ::nTotalVale - ::nTotalTarjeta - ::nTotalTalon,oGetDevolucion:refresh(),.t.)
redefine SBUTTON aoButtons[1] id 301 OF odlg PROMPT "&7" FILENAME ".\bmp\BUTTONS\enter.bmp" ACTION (SendKeysGets(oGetCantidad,"7"),nDevolucion:=oThis:nTotalVenta - val(cValtoChar(nCantidad)),oGetDevolucion:refresh()) CRYSTAL NOBORDER COLORS CLR_WHITE, RGB(0,0,0) TEXT ON_BOTTOM FONT oFonts:oFontTextoNegritaExtraGrande
procedure SendKeysGets(oWnd,cKey)
oWnd:setfocus()
SENDKEY(cKey)
oWnd:refresh()
oWnd:setfocus()
return
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: cmsoft and 34 guests