// C:\VERTIZ\VERTIZ2.PRG - 21/07/2021 - By Joao Santos - Sao Paulo/Brasil.// C:\VERTIZ\VERTIZ2.RC - 18/06/2024 - By Joao Santos - Sao Paulo/Brasil.#Include "FiveWin.ch"STATIC oWnd, lLigaBtn := .F., lEdit := .T.
FUNCTION Main
() LOCAL oMenu
SetBalloon
( .T.
) // Balloon shape required for tooltips SkinButtons
() menu oMenu
MenuItem "From Resource" action FromrES
( oWnd
) endmenu define window oWnd
title "VERTIZ: Teste de Contraseña" menu oMenu
pixel activate window oWnd
MaximizedRETURN( oWnd
)Function FromRes
( oWnd
) LOCAL oDlg, oFont, wFonte_FixedSys, oContinuar, oSaida, IDCor, oGroup
LOCAL aGrad, aGet := ARRAY
(5), XPASSWORD := SPACE
(10) // "Enrique" LOCAL oMuestra
SETCAPSLOCK
( .T.
) // = Liga e desliga o Capslock // aGrad := { { 0.30, CLR_BLACK, CLR_YELLOW},{ 0.50, CLR_YELLOW, CLR_BLACK } } aGrad :=
{ { 0.30, CLR_CYAN, CLR_HCYAN
},
{ 0.70, CLR_HCYAN, CLR_CYAN
} } DEFINE FONT oFont
NAME "Tahoma" SIZE 0,
-16 BOLD
DEFINE FONT wFonte_FixedSys
NAME "FixedSys" SIZE 10,
10 DEFINE DIALOG oDlg
RESOURCE "DLG_PASSWORD" OF oWnd GRADIENT aGrad
oDlg:
lHelpIcon := .F.
For iDcor=
401 TO 405 REDEFINE SAY ID IDCor
OF oDlg COLORS CLR_BLACK, CLR_WHITE ;
UPDATE FONT wFonte_FixedSys TRANSPARENT
Next IDCor
// By Ednaldo Rolim - Yes! // Salida REDEFINE SAY ID 420 OF oDlg COLORS CLR_BLACK, CLR_WHITE ;
UPDATE FONT wFonte_FixedSys TRANSPARENT
REDEFINE GROUP oGroup
ID 501 COLOR CLR_BLACK, CLR_WHITE
OF oDlg ;
FONT wFonte_FixedSys TRANSPARENT
IF Set
( _SET_INSERT, ! Set
( _SET_INSERT
) ) Set
( _SET_INSERT, ! Set
( _SET_INSERT
) ) ENDIF //-> PARA GRABAR, USE: ENCRYPT / DECRYPT REDEFINE GET aGet
[1] VAR XPASSWORD
PICTURE "@KR" ID 20 OF oDlg ;
FONT oFont
UPDATE COLOR CLR_BLACK, CLR_YELLOW
WHEN( lEdit
) ;
// use Disable() VALID VERIFICA_PASSWORD
( aGet, XPASSWORD, oContinuar
) aGet
[1]:
lPassword := .T.
aGet
[1]:
cToolTip :=
"Digite Contraseña" aGet
[1]:
lBtnTransparent := .T.
// transparent button aGet
[1]:
lAdjustBtn := .T.
// Button Get Adjust aGet
[1]:
lDisColors := .F.
// Deactive disable color aGet
[1]:
nClrTextDis := CLR_BLACK
// Color text disable status aGet
[1]:
nClrPaneDis := CLR_YELLOW
// Color Pane disable status // SOLO PARA PRUEBAS // Invisible GET - SIN CLAUSULA PASSWORD EN EL GET DEL DIALOGO. REDEFINE GET aGet
[2] VAR XPASSWORD
PICTURE "@KR" ID 21 OF oDlg ;
FONT oFont
UPDATE COLOR CLR_BLACK, CLR_YELLOW
aGet
[2]:
lPassword := .T.
REDEFINE BUTTONBMP oContinuar
ID 301 OF oDlg
WHEN( lLigaBtn
) ;
ACTION( oDlg:
End(), MI_FUNCION
() ) REDEFINE BUTTONBMP oSaida
ID 302 OF oDlg
ACTION( oDlg:
End() ) CANCEL
oSaida:
cToolTip :=
"Saida - Exit - Cancelar " REDEFINE BUTTONBMP oMuestra
ID 303 OF oDlg ;
ACTION( MUESTRA_PASSWORD
( aGet, XPASSWORD
) ) SET
FONT OF oContinuar
TO wFonte_FixedSys
SET
FONT OF oSaida
TO wFonte_FixedSys
SET
FONT OF oMuestra
TO wFonte_FixedSys
ACTIVATE DIALOG oDlg
CENTERED ON INIT( aGet
[2]:
Hide() ) oFont:
End() wFonte_FixedSys:
End() SETCAPSLOCK
( .F.
) // = Liga e desliga o Capslock return nilFUNCTION VERIFICA_PASSWORD
( aGet, CPASSWORD, oContinuar
) LOCAL xcPassword
IF( ALLTRIM
( CPASSWORD
) ) ==
"Enrique" ?
"Password esta bien continue... " + CPASSWORD
lLigaBtn := .T.
oContinuar:
Enable() oContinuar:
Refresh() ELSE ?
"Password no esta bien retorne... " + CPASSWORD
// xcPassword := SPACE(10) lEdit := .F.
// aGet[1]:VARPUT( xcPassword ) aGet
[1]:
Disable() // Aqui, master Carlos. aGet
[1]:
Refresh() lLigaBtn := .F.
oContinuar:
Disable() oContinuar:
Refresh() RETURN( .F.
) ENDIFRETURN( .T.
)FUNCTION MUESTRA_PASSWORD
( aGet, CPASSWORD
) IF( .NOT. EMPTY
( CPASSWORD
) ) // ? CPASSWORD, ENCRYPT( CPASSWORD ) // ? DECRYPT( CPASSWORD ), CPASSWORD aGet
[1]:
Hide() aGet
[2]:
Show() aGet
[2]:
VARPUT( CPASSWORD
) aGet
[2]:
Refresh() ELSE ?
"ASI NO, ESTA VACIO HOMBRE!" ENDIFRETURN NILFUNCTION MI_FUNCION
() ?
[CONTINUE... TU DIALOGO...
]RETURN NIL*----------------------------------------------------------------------
* Vejam com funciona
*----------------------------------------------------------------------
* SETCAPSLOCK
( .T. ou .F.
) = Liga e desliga o Capslock
* SETNUMLOCK
( .T. ou .F.
) = Liga e desliga o NumLock
* SETSCROLLOCK
( .T. ou .F.
) = Liga e desliga o ScrollLock
* SETINSERT
( .T. ou .F.
) = Liga e desliga o Insert
*----------------------------------------------------------------------
* VERCAPSLOCK
() = Sem parametros retorna o estado
do Capslock
* VERNUMLOCK
() = Sem parametros retorna o estado
do NumLock
* VERSCROLLOCK
() = Sem parametros retorna o estado
do ScrollLock
* VERINSERT
() = Sem parametros retorna o estado
do Insert
*----------------------------------------------------------------------
/*
*************
function MAIN
*************
? SETCAPSLOCK( .F. )
? "Desligando o CapsLock"
SETCAPSLOCK( .T. )
? "Ligando o CapsLock"
SETCAPSLOCK( .F. )
? "Desligando o CapsLock"
SETCAPSLOCK( .T. )
? "Ligando o CapsLock"
SETCAPSLOCK( .F. )
? "Desligando o CapsLock"
? "O Capslock esta' " + iif( VERCAPSLOCK(), "Ligado", "Desligado" )
SETNUMLOCK( .F. )
? "Desligando o NumLock"
SETNUMLOCK( .T. )
? "Ligando o NumLock"
SETNUMLOCK( .F. )
? "Desligando o NumLock"
SETNUMLOCK( .T. )
? "Ligando o NumLock"
SETNUMLOCK( .F. )
? "Desligando o NumLock"
? "O Numlock esta' " + iif( VERNUMLOCK(), "Ligado", "Desligado" )
SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"
SETSCROLLOCK( .T. )
? "Ligando o ScrollLock"
SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"
SETSCROLLOCK( .T. )
? "Ligando o ScrollLock"
SETSCROLLOCK( .F. )
? "Desligando o ScrollLock"
? "O ScrollLock esta' " + iif( VERSCROLLOCK(), "Ligado", "Desligado" )
SETINSERT( .T. )
? "Ligando o Insert"
SETINSERT( .F. )
? "Desligando o Insert"
? "O Insert esta' " + iif( VERINSERT(), "Ligado", "Desligado" )
return NIL
*/*------------------------------------------------------------*
* FUNCAO PARA ATIVAR A TECLA CAPSLOCK *
*------------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( SETCAPSLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
if( (hb_parl
(1) && !
(keyState
[VK_CAPITAL
] &
0)) ||
(!hb_parl
(1) &&
(keyState
[VK_CAPITAL
] &
1)) ) { keybd_event
( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY |
0,
0 );
keybd_event
( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA ATIVAR A TECLA NUMLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( SETNUMLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
if( (hb_parl
(1) && !
(keyState
[VK_NUMLOCK
] &
0)) ||
(!hb_parl
(1) &&
(keyState
[VK_NUMLOCK
] &
1)) ) { keybd_event
( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY |
0,
0 );
keybd_event
( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA ATIVAR A TECLA SCROLLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( SETSCROLLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
if( (hb_parl
(1) && !
(keyState
[VK_SCROLL
] &
0)) ||
(!hb_parl
(1) &&
(keyState
[VK_SCROLL
] &
1)) ) { keybd_event
( VK_SCROLL, 0x45, KEYEVENTF_EXTENDEDKEY |
0,
0 );
keybd_event
( VK_SCROLL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA ATIVAR A TECLA SCROLLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( SETINSERT
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
if( (hb_parl
(1) && !
(keyState
[VK_INSERT
] &
0)) ||
(!hb_parl
(1) &&
(keyState
[VK_INSERT
] &
1)) ) { keybd_event
( VK_INSERT, 0x45, KEYEVENTF_EXTENDEDKEY |
0,
0 );
keybd_event
( VK_INSERT, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}}#pragma enddump
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( VERCAPSLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
hb_retl
( keyState
[VK_CAPITAL
] );
}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA VERIFICAR A TECLA NUMLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( VERNUMLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
hb_retl
( keyState
[VK_NUMLOCK
] );
}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA VERIFICAR A TECLA SCROLLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( VERSCROLLOCK
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
hb_retl
( keyState
[VK_SCROLL
] );
}#pragma enddump
*-----------------------------------------------------------*
* FUNCAO PARA VERIFICAR A TECLA SCROLLOCK *
*-----------------------------------------------------------*
#pragma begindump
#define _WIN32_IE 0x0500
#define HB_OS_WIN_32_USED
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include "hbapi.h"HB_FUNC ( VERINSERT
){BYTE keyState
[256];
GetKeyboardState
((LPBYTE
)&keyState
);
hb_retl
( keyState
[VK_INSERT
] );
}#pragma enddump
// - fin / end - kapiabafwh@gmail.com