// C:\VERTIZ\VERTIZ2.PRG - 21/07/2021 - By Joao Santos - Sao Paulo/Brasil.
// C:\VERTIZ\VERTIZ2.RC - 05/07/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 Maximized
RETURN( oWnd )
Function FromRes( oWnd )
LOCAL oDlg, oFont, wFonte_FixedSys, oContinuar, oSaida, IDCor, oGroup
LOCAL aGrad, aGet := ARRAY(5), XPASSWORD := SPACE(50) // "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 - bitmap 16/x16
REDEFINE GET aGet[1] VAR XPASSWORD PICTURE "@KR" ID 20 OF oDlg ;
FONT oFont UPDATE COLOR CLR_BLACK, CLR_YELLOW WHEN( lEdit ) ; // use Disable()
BITMAP "..\BITMAPS\FIND.BMP" ;
VALID VERIFICA_PASSWORD( aGet, XPASSWORD, oContinuar ) ;
ACTION VERIFICA_PASSWORD( aGet, XPASSWORD, oContinuar )
aGet[1]:bKeyDown := { |nKey| IF( nKey == VK_F7, Eval( aGet[1]:bAction ), Nil ) }
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 nil
FUNCTION 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. )
ENDIF
RETURN( .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!"
ENDIF
RETURN NIL
FUNCTION 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
/* // VERTIZ2.RC
DLG_PASSWORD DIALOG 256, 98, 238, 148
STYLE DS_ABSALIGN | DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "VERTIZ: Contraseña"
FONT 8, "MS Sans Serif"
{
EDITTEXT 20, 57, 63, 70, 14, ES_CENTER | ES_MULTILINE | ES_PASSWORD | WS_BORDER | WS_GROUP | WS_TABSTOP
EDITTEXT 21, 57, 63, 70, 14, ES_CENTER | ES_MULTILINE | WS_BORDER | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Confirma", 301, 68, 96, 70, 14
PUSHBUTTON "&Salida", 302, 140, 96, 50, 14
PUSHBUTTON "&Muestra", 303, 170, 64, 50, 14
CTEXT "ATENÇÃO: CHAME O SUPERVISOR.", 401, 1, 3, 236, 12, SS_CENTER | NOT WS_GROUP
CTEXT "OBRIGATÓRIO SENHA MASTER.", 402, 1, 15, 236, 12, SS_CENTER | NOT WS_GROUP
CTEXT "Digite Contraseña Master", 403, 19, 30, 200, 12, SS_CENTER | NOT WS_GROUP
GROUPBOX "Digite Contraseña Correta", 501, 17, 44, 150, 50, BS_GROUPBOX
LTEXT "<ESC> Salir", 420, 5, 97, 60, 14, NOT WS_GROUP
CTEXT "SOMENTE USUÁRIO MASTER.", 404, 2, 113, 236, 14, SS_CENTER | NOT WS_GROUP
CTEXT "GERENTE OU O DONO DA EMPRESA.", 405, 1, 127, 236, 14, SS_CENTER | NOT WS_GROUP
}
*/
// - fin / end - kapiabafwh@gmail.com
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 71 guests