Este comando solo funciona en Windows XP.
- Code: Select all Expand view RUN
SETNEWTIME( wHOR, wMIN, wSEG )
SETNEWDATE( wANO, wMES, wDIA )
Gracias, regards, Saludos.
SETNEWTIME( wHOR, wMIN, wSEG )
SETNEWDATE( wANO, wMES, wDIA )
BOOL IsUserAdmin(VOID)
/*++
Routine Description: This routine returns TRUE if the caller's
process is a member of the Administrators local group. Caller is NOT
expected to be impersonating anyone and is expected to be able to
open its own process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group. --
*/
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
// testing the FiveWin SetFTime() function to change the
// time & date of a file
// And the new GetFTime() to retrieve the time and date
#include "FiveWin.Ch"
#include "fileio.ch"
function Main()
local hFile := FOpen( "customer.dbf", FO_READWRITE )
local aInfo
SET DATE FRENCH
SET CENTURY ON
SetFTime( hFile, "01:02:03", CToD( "11/12/96" ) )
MsgInfo( "Done!" )
aInfo = GetFTime( hFile )
MsgInfo( "Time: " + aInfo[ 1 ] )
if __SetCentury()
aInfo[ 2 ] = CToD( Str( Day( aInfo[ 2 ] ), 2 ) + "/" + Str( Month( aInfo[ 2 ] ), 2 ) + ;
"/" + Str( Year( aInfo[ 2 ] ) - 2000, 4 ) )
endif
MsgInfo( "Date: " + DToC( aInfo[ 2 ] ) )
FClose( hFile )
return nil
// Funcao Para Mostrar a Hora de Brasilia em Tempo Real na Tela.
#Include "FiveWin.ch"
STATIC oDlg, oTimer, oWnd
FUNCTION BRASILIA()
LOCAL oIco, aGet := ARRAY(5), cHoraBra := " "
DEFINE DIALOG oDlg TITLE "Hora de Brasilia" COLOR "W+/B"
@ 0.50, 09 SAY "Hora de Brasilia" SIZE 050, 10 OF oDlg ;
COLORS CLR_BLACK, CLR_WHITE CENTER
@ 2, 08 GET aGet[1] VAR cHoraBra PICTURE "99:99:99" OF oDlg CENTER
aGet[1]:lBtnTransparent := .t. // transparent button get aGet[1]
aGet[1]:Disable() // When( .F. )
aGet[1]:lBtnTransparent := .t. // transparent button get aGet[1]
aGet[1]:lAdjustBtn := .t. // Button Get Adjust Witdh aGet[1]
aGet[1]:lDisColors := .f. // Deactive disable color
aGet[1]:nClrTextDis := CLR_WHITE // Color text disable status
aGet[1]:nClrPaneDis := CLR_BLACK // Color Pane disable status
aGet[1]:lAdjustBtn := .t.
@ 3, 10 BUTTON "&Saida" SIZE 40, 12 DEFAULT ;
ACTION( oTimer:DeActivate(), oDlg:End() ) CANCEL UPDATE
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT( PEGA_TIMER_BRASIL( aGet, oWnd ) )
RETURN NIL
//-> ACIONA O TIMER DO RELOGIO DE BRASILIA NO DIALOGO
FUNCTION PEGA_TIMER_BRASIL( aGet, oWnd )
DEFINE TIMER oTimer INTERVAL 0 OF oDlg ;
ACTION HORABRASILIA( aGet, oWnd )
ACTIVATE TIMER oTimer
RETURN NIL
//-> HORA EXATA DE BRASILIA
FUNCTION HORABRASILIA( aGet, oWnd )
LOCAL oHttp, cHtml
LOCAL cHora
IF IsInternet() // Se tiver internet ativa
oHttp := CreateObject( "winhttp.winhttprequest.5.1" )
oHttp:Open( "GET", "http://24timezones.com/pt_horamundial/brasilia_hora_local.php" , .F. )
oHttp:Send()
cHtml:= oHttp:ResponseText()
cHtml:= left(alltrim(StrExtract(cHtml, '<span id="currentTime">', '</span>' )),8)
cHora := TRANSF( cHtml, "99:99:99" )
aGet[1]:VARPUT( cHora )
aGet[1]:Refresh()
ELSE
cHora := [SEM NET]
aGet[1]:VARPUT( cHora )
aGet[1]:Refresh()
ENDIF
RETURN NIL
STATIC FUNCTION StrExtract(cText,cAfter,cBefore)
LOCAL cRet := SUBSTR(cText,AT(cAfter,cText) + LEN(cAfter))
LOCAL n
IF (n := AT(cBefore,cRet)) > 0
cRet := LEFT(cRet,n - 1)
ENDIF
RETURN(cRet)
//-> Funcao para checar a Internet
FUNCTION IsInternet()
LOCAL cIp, cVret := .F.
WsaStartUp()
// conforme pessoal do forum, e para chamar duas vezes
cIp := GETHOSTBYNAME( "microsoft.com" )
cIp := GETHOSTBYNAME( "microsoft.com" )
WsaCleanUp()
// Seguranca caso o provedor da microsoft esteja fora do ar...
IF ( cIp <= "0.0.0.0" )
WsaStartUp()
cIp := GetHostByName( "google.com" )
cIp := GetHostByName( "google.com" )
WsaCleanUp()
ENDIF
RETURN( cIp<>"0.0.0.0" )
// FIM DO PROGRAMA
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 46 guests