Autor Tema: Detectar cuando se cambia la hora y la fecha del sistema windows probado en xp  (Leído 2741 veces)

0 Usuarios y 1 Visitante están viendo este tema.

obethermy

  • Megabyte
  • ***
  • Mensajes: 116
  • Reputación: +6/-7
    • Ver Perfil
Este programa hecho en visual basic 6 para detectar que si se cambio la hora y la fecha del sistema windows. Se puede modificar para que guarde las modificaciones hechas en un archivo de texto o una base de datos.

Probado en windows xp si funciona en otro windows notificarlo por aqui.
Consta de un formulario y un modulo.bas

form1
Código: (VB) [Seleccionar]
Option Explicit

Private Sub Form_Load()
ShowWindow Me.hwnd, 1
Do While GetMessage(Msg, 0, 0, 0)
DispatchMessage Msg
AdmMsg Me.hwnd, Msg.message, Msg.wParam, Msg.lParam
DoEvents
Loop
End Sub

Modulo1.bas
Código: (VB) [Seleccionar]
Option Explicit

Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As Msg) As Long
Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, _
ByVal hwnd As Long, _
ByVal wMsgFilterMin As Long, _
ByVal wMsgFilterMax As Long) As Long

Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Declare Sub PostQuitMessage Lib "user32" (ByVal nExitCode As Long)
Public Const WM_TIMECHANGE = &H1E
Public Const WM_DESTROY = &H2
Type POINTAPI
        x As Long
        y As Long
End Type
Type Msg
    hwnd As Long
    message As Long
    wParam As Long
    lParam As Long
    time As Long
    pt As POINTAPI
End Type
Public Msg As Msg

Public Function AdmMsg(ByVal hwnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case Msg
Case WM_TIMECHANGE
MsgBox "BERRROOOO....! Chamo(a) te cambiaron la hora del SISTEMA! ", vbInformation
Case WM_DESTROY
PostQuitMessage 0
End Select
End Function