Simples demás.... hahahaha y no uso HABROUR ni de pago. hahahahahaha.
Code: Select all | Expand
// C:\FWH\SAMPLES\SILVMAIL.PRG - By: kapiabafwh@gmail.com
#include "FiveWin.ch"
#include "HbCompat.ch" // para Harbour Silvio.
STATIC lIsValid := .F., oBtn
FUNCTION Main()
LOCAL oDlg, oGet, oFont, oFnt, oSaida, oSil, cTitle, oSay, cSay, oBrush
LOCAL cEmail := SPACE( 50 ), cSilv := SPACE(50)
SetBalloon( .T. ) // Balloon shape required for tooltips
SetGetColorFocus()
SkinButtons()
cSay := "INGRESE EL CORREO ELECTRÓNICO:"
cTitle := "FIVEWIN: VALIDAR EMAIL BY SILVIO FALCONI"
DEFINE BRUSH oBrush FILE "..\bitmaps\sea.bmp" RESIZE
DEFINE FONT oFnt NAME "Segoe UI" SIZE 0, -12 BOLD
DEFINE FONT oFont NAME "Segoe UI" SIZE 0, -18 BOLD
DEFINE DIALOG oDlg SIZE 600, 300 PIXEL TRUEPIXEL BRUSH oBrush ;
TITLE cTitle FONT oFont TRANSPARENT
oDlg:lHelpIcon := .F.
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
// SOLO PARA TESTES:
@ 05, 40 GET oSil VAR cSilv SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg ;
FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE WHEN( .F. )
@ 50, 40 SAY oSay VAR cSay SIZE 400, 40 PIXEL PICTURE "@!" OF oDlg ;
FONT oFont UPDATE COLOR CLR_WHITE, CLR_BLACK TRANSPARENT
@ 80, 40 GET oGet VAR cEmail SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg ;
FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE ;
VALID( VALIDA_EMAIL_SILVIO( cEmail ) )
oGet:cToolTip := "Ingrese el Email Correcto"
oGet:bLostFocus := { || oGet:SetColor( CLR_BLACK, CLR_WHITE) }
oGet:bGotFocus := { || oGet:SetColor( CLR_BLACK, nRGB( 255, 255, 45 ) ), ;
oGet:SetSel( 0, 0 ) }
@ 200, 40 BTNBMP oBtn PROMPT "Enviar Email Via OutLook Express" LEFT ;
FILE "..\bitmaps\alphabmp\gmail.bmp", "", ;
"..\bitmaps\alphabmp\question.bmp", "" ;
SIZE 220, 60 PIXEL OF oDlg FLAT 2007 GDIPLUS FONT oFont ;
COLOR CLR_WHITE, CLR_BLACK ;
ACTION( ENVIAR_EMAIL( cEmail ) ) ;
WHEN( lIsValid )
oBtn:cToolTip := "Enviar Email Final"
oBtn:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }
WITH OBJECT oBtn
:nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK // border color
:bColorMap := { || { { CLR_YELLOW, CLR_BLACK } } } // image color
END
@ 200, 350 BTNBMP oSaida PROMPT "Salida del Programa" LEFT FONT oFont ;
FILE "..\bitmaps\Exit.bmp" SIZE 220, 60 PIXEL OF oDlg FLAT 2007 GDIPLUS;
COLOR CLR_WHITE, CLR_BLACK ACTION( oDlg:End() )
oSaida:cToolTip := "Salida - Exit - Cancelar"
oSaida:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }
WITH OBJECT oSaida
:nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK // border color
:bColorMap := { || { { CLR_YELLOW, CLR_BLACK } } } // image color
END
oSaida:lCancel := .T.
@ 275, 05 SAY "<ESC> Salir" SIZE 100, 40 PIXEL PICTURE "@!" OF oDlg ;
FONT oFnt UPDATE COLOR CLR_HRED, CLR_WHITE TRANSPARENT
@ 275, 350 SAY "kapiabafwh@gmail.com" SIZE 200, 40 PIXEL PICTURE "@" ;
OF oDlg FONT oFont UPDATE COLOR CLR_HBLUE, CLR_WHITE TRANSPARENT
ACTIVATE DIALOG oDlg CENTERED ON INIT( oSil:Hide() )
IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
Set( _SET_INSERT, ! Set( _SET_INSERT ) )
ENDIF
RELEASE BRUSH oBrush
RELEASE FONT oFnt
RELEASE FONT oFont
RETURN NIL
FUNCTION VALIDA_EMAIL_SILVIO( cEmailSivio )
LOCAL cContaUsuario, cNomeUsuario
// LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
// LOCAL cRegEx := "^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
// LOCAL cRegEx := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")
LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
IF GETASYNCKEY( VK_UP )
lIsValid := .F.
oBtn:Disable()
oBtn:Refresh()
RETURN( .F. )
ENDIF
IF EMPTY( cEmailSivio )
MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO: " )+CRLF+ ;
OemToAnsi( "DIGITE O NOME DA CONTA DE EMAIL. " )+CRLF+ ;
OemToAnsi( "Exemplo: kapiabafwh@gmail.com " ), ;
OemToAnsi( "EMAIL(Conta) NÇO INFORMADO. CUIDADO!" ) )
RETURN( .F. )
ENDIF
// IF ( HB_REGEXLIKE( ALLTRIM( LOWER( cEmailSivio ) ), cRegEx ) )
// funciona con HBCOMPAT.CH
IF ( ALLTRIM(LOWER( cEmailSivio ) ) LIKE cRegEx )
lIsValid := .T.
ELSE
MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO: " )+CRLF+ ;
OemToAnsi( "DIGITE UM EMAIL VÇLIDO.. " )+CRLF+ ;
OemToAnsi( "ESTA CONTA DE EMAIL ESTµ ERRADA.. " )+CRLF+ ;
OemToAnsi( "Exemplo: kapiabafwh@gmail.com " )+CRLF+ ;
OemToAnsi( "VOCÒ DIGITOU: " + ALLTRIM( cEmailSivio ) ), ;
OemToAnsi( "EMAIL(Conta) CONTENDO ERROS... VEJA!" ) )
ENDIF
IF( lIsValid )
XFOCUS( oBtn ) // foco en el botton de envio.
ENDIF
RETURN( lIsValid )
FUNCTION ENVIAR_EMAIL( cEmailEnv )
? "Enviar Email Final harbour/xHarbour"
RETURN NIL
STATIC FUNCTION xFocus( oObj )
xSetFocus( oObj )
xSetFocus( oObj )
RETURN( .T. )
STATIC FUNCTION xSetFocus( oObj )
LOCAL _oWnd := oObj:oWnd, _oTempo := ""
DEFINE Timer _oTempo Interval 10 OF _oWnd ;
ACTION ( oObj:SetFocus(), _oTempo:End() )
ACTIVATE Timer _oTempo
RETURN( .T. )
// FIN / END - kapiabafwh@gmail.com
Regards, saludos.