Const MAX_COMPUTERNAME_LENGTH = 255
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function ComputerName() As String
    'Devuelve el nombre del equipo actual
    Dim sComputerName As String
    Dim ComputerNameLength As Long

    sComputerName = String(MAX_COMPUTERNAME_LENGTH + 1, 0)
    ComputerNameLength = MAX_COMPUTERNAME_LENGTH
    Call GetComputerName(sComputerName, ComputerNameLength)
    ComputerName = Mid(sComputerName, 1, ComputerNameLength)
End Function

Public Function inserta_vitacora_alumno(Ci_alu As String, accion_realizada As String) As Boolean
    
    Dim var_sql As String
    inserta_vitacora_alumno = False
    
    var_sql = "insert into hist_vitacora_alumno(login_usuario,nombre_usuario,IP,PC,Fecha," _
            & "Hora,ci_alu,accion_realizada) values ('" _
            & Nom_usu_ses & "','" & Nom_com_usu_ses & "','" _
            & Form_main.Winsock1.LocalIP & "','" & ComputerName & "'," _
            & "current_date,current_time,'" _
            & Ci_alu & "','" & accion_realizada & "');"
    conn.Execute var_sql
    inserta_vitacora_alumno = True
End Function


