Code: Select all
#include 'FiveWin.ch'
#define LWA_COLORKEY 1
#define LWA_ALPHA 3
#define GWL_EXSTYLE -20
#define WS_EX_LAYERED 524288
#define SRCPAINT 15597702 // 0xEE0086
#define SRCAND 8913094
Function Main()
local old_sel := select()
local oDlg, oBmp1, oBmp2, oBtn, oBtn2, oGet[2], cWndText // , oSay
local cLogin, cPass, lChk
local nMail, lOldWrk := .F.
LOCAL nFactor := 230, btnmais, btnmenos, btnloops
LOCAL oBrush, oSay[4], oFnt0, oFnt2, oFnt1, oFnt3, oFnt4, oFnt5, oCbx, oHeaderDlg
LOCAL cLang := 'English '
cLogin := space(10)
cPass := space(10)
DEFINE FONT oFnt0 NAME "Tahoma" SIZE 0, -16 BOLD
DEFINE FONT oFnt1 NAME "Tahoma" SIZE 0, -12 BOLD
DEFINE FONT oFnt2 NAME "Tahoma" SIZE 0, -18 BOLD
DEFINE FONT oFnt3 NAME "Umbra-Normal" SIZE 0, -40 BOLD
DEFINE FONT oFnt4 NAME "Tahoma" SIZE 0, -18 BOLD
DEFINE FONT oFnt5 NAME "Tahoma" SIZE 0, -12
DEFINE BITMAP oBmp1 FILE 'LOGIN1.BMP' OF oDlg
DEFINE BITMAP oBmp2 FILE 'LOGIN2.BMP' OF oDlg
DEFINE BRUSH oBrush COLOR CLR_GREEN // STYLE NULL
DEFINE DIALOG oDlg;
BRUSH oBrush ;
STYLE WS_POPUP ; // nOr( DS_MODALFRAME, WS_POPUP, WS_DLGFRAME, WS_SYSMENU, 4 ) ;
FONT oFnt0 ;
PIXEL FROM 0, 0 TO 415, 470 ;
TITLE "EASYFO"
@ 18, 70 SAY oSay[3] PROMPT 'EASYFO' COLOR CLR_WHITE SIZE 70, 25 FONT oFnt3 PIXEL
oSay[3]:lTransparent := .T.
@ 45, 70 SAY oSay[3] PROMPT 'Hotel Management System' COLOR CLR_HRED SIZE 130, 13 FONT oFnt4 PIXEL
oSay[3]:lTransparent := .T.
@ 80, 45 SAY oSay[1] PROMPT "Login Name" COLOR CLR_WHITE SIZE 50,12 PIXEL
oSay[1]:lTransparent := .T.
@ 108, 45 SAY oSay[2] PROMPT "Password" COLOR CLR_WHITE SIZE 50,12 PIXEL
oSay[2]:lTransparent := .T.
@ 150, 45 SAY oSay[4] PROMPT 'Language' OF oDlg COLOR CLR_WHITE SIZE 30, 12 PIXEL FONT oFnt1
oSay[4]:lTransparent := .T.
@ 93,45 GET oGet[1] VAR cLogin PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PIXEL
* VALID ((!empty(cLogin).and.if(lChk := ChkUser(@cLogin,@cLang), ( oCbx:Refresh(), .T. ), (oGet[1]:Refresh(),.F.) )).or.oBtn:lMouseOver)
@ 121,45 GET oGet[2] VAR cPass PICTURE '@!' COLOR CLR_BLUE, CLR_WHITE SIZE 140, 14 PASSWORD PIXEL ;
FONT oFnt2
* VALID (oBtn:lMouseOver.or.(!empty(cPass).and.iif(lChk := ChkPass(@cPass),(oBtn:SetFocus(),.T.),(oGet[2]:Refresh(),.F.))))
@ 157, 120 BUTTON oBtn ; // FILE 'BMP\UNLOCK.BMP','BMP\LOCK.BMP','BMP\LOCK.BMP','BMP\UNLOCK.BMP' ;
PROMPT 'LogIn' ;
WHEN (!empty(cLogin) .and. !empty(cPass)) ;
SIZE 45, 16 PIXEL ;
FONT oFnt1 ; // TEXT ON_RIGHT ; // XP ;
ACTION ( lChk := .T. ,oDlg:End())
@ 157, 170 BUTTON oBtn2 ; // FILE 'BMP\EXIT.BMP' ;
PROMPT 'Exit' ;
SIZE 45, 16 PIXEL ;
FONT oFnt1 ; // TEXT ON_RIGHT ; // XP ;
ACTION ( lChk := .F. ,oDlg:End())
@ 160, 45 COMBOBOX oCbx VAR cLang ITEMS {'Thai ','English '} OF oDlg SIZE 60, 150 PIXEL FONT oFnt5
ACTIVATE DIALOG oDlg CENTER ON INIT SetTransparent( oDlg ) ; // SETTRANSP( oDlg ) ;
ON PAINT ( PalBmpDraw( oDlg:hDC, 0, 0, oBmp2:hBitmap, 0, 0, 0, SRCPAINT ),;
PalBmpDraw( oDlg:hDC, 0, 0, oBmp1:hBitmap, 0, 0, 0, SRCAND ))
oFnt0:End()
oFnt1:End()
oFnt2:End()
oFnt3:End()
oFnt4:End()
oFnt5:End()
return
STATIC FUNCTION SETTRANSPARENT( oDlg )
SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) )
SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, CLR_GREEN,, LWA_COLORKEY ) // CLR_BLUE
RETURN NIL