VERSION 5.00
Begin VB.Form form_mensajeria 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Mensajería Instantánea"
   ClientHeight    =   4185
   ClientLeft      =   2670
   ClientTop       =   2445
   ClientWidth     =   9180
   Icon            =   "form_mensajeria.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   4185
   ScaleWidth      =   9180
   Begin VB.CommandButton Btn_vac_cancelar 
      Caption         =   "Cancelar"
      Height          =   375
      Left            =   5160
      TabIndex        =   2
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton Btn_vac_aceptar 
      Caption         =   "Enviar"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   3600
      Width           =   1215
   End
   Begin VB.Frame frame_mensajeria 
      Height          =   3255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   8895
      Begin VB.ListBox lst_usu_destino 
         Height          =   1425
         Left            =   240
         TabIndex        =   7
         Top             =   1200
         Width           =   3735
      End
      Begin VB.Frame frame_contenido 
         Caption         =   "Contenido"
         Height          =   1575
         Left            =   4080
         TabIndex        =   5
         Top             =   1080
         Width           =   4575
         Begin VB.TextBox Txt_Contenido 
            Height          =   1215
            Left            =   120
            MultiLine       =   -1  'True
            ScrollBars      =   3  'Both
            TabIndex        =   6
            Top             =   240
            Width           =   4335
         End
      End
      Begin VB.CheckBox chk_msn_todos 
         Caption         =   "Enviar a todos los usuarios"
         Height          =   255
         Left            =   4320
         TabIndex        =   4
         Top             =   720
         Width           =   2775
      End
      Begin VB.Label lbl_remite 
         Height          =   255
         Left            =   1320
         TabIndex        =   9
         Top             =   360
         Width           =   7215
      End
      Begin VB.Label Label2 
         Caption         =   "Remite: "
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "Dejar mensaje a :"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   840
         Width           =   1575
      End
   End
End
Attribute VB_Name = "form_mensajeria"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim usuariomensajes() As String
Private Sub Btn_vac_aceptar_Click()
If Me.lst_usu_destino.SelCount > 0 Then
    If Len(Trim(Me.Txt_Contenido.Text)) <> 0 Then
        For t = 0 To Me.lst_usu_destino.ListCount - 1
            If Me.lst_usu_destino.Selected(t) Then
                conn.Execute "INSERT INTO mensajeria(fec_men, hor_men, usu_nom_usu, aut_nombre_usuario, mensaje,leido) values('" & InvierteFecha(Date, "R") & "', '" & Time() & "' , '" & usuariomensajes(t) & "','" & Nom_usu_ses & "', '" & Me.Txt_Contenido.Text & "'," & 0 & ")"
            End If
        Next
        If Me.lst_usu_destino.SelCount > 1 Then
            MsgBox ("Sus mensajes han sido enviados exitósamente")
        Else
            MsgBox ("Su mensaje ha sido enviado exitósamente")
        End If
        Unload Me
    Else
        MsgBox ("Debe escribir un mensaje")
        Me.Txt_Contenido.SetFocus
    End If
Else
    MsgBox ("Debe seleccionar destinatario")
    Me.lst_usu_destino.SetFocus
End If
End Sub

Private Sub Btn_vac_cancelar_Click()
Unload Me
End Sub

Private Sub chk_msn_todos_Click()
If Me.chk_msn_todos.Value Then
    For t = 0 To Me.lst_usu_destino.ListCount - 1
        Me.lst_usu_destino.Selected(t) = True
    Next t
    Me.frame_contenido.Enabled = True
    Me.Txt_Contenido.SetFocus
Else
    'Call llenacombo(cmb_usu_destino, "usuarios", "nombre_completo_usu", "")
    For t = 0 To Me.lst_usu_destino.ListCount - 1
        Me.lst_usu_destino.Selected(t) = False
    Next t
End If
End Sub


Private Sub Form_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub Form_Load()
Set rs = New ADODB.Recordset
form_mensajeria.Height = 4590
form_mensajeria.Width = 9300
Me.lbl_remite.Caption = Nom_com_usu_ses
rs.CursorLocation = adUseClient
a = " SELECT nombre_completo_usu , aut_nombre_usuario FROM usuarios"
rs.Open a, conn
If rs.RecordCount > 0 Then
    ReDim usuariomensajes(rs.RecordCount)
    t = 0
    While Not rs.EOF
        If rs("aut_nombre_usuario") <> Nom_usu_ses Then
            Me.lst_usu_destino.AddItem rs("nombre_completo_usu")
            usuariomensajes(t) = rs("aut_nombre_usuario")
            t = t + 1
        End If
        rs.MoveNext
    Wend
End If
rs.Close


'Me.frame_contenido.Enabled = False
End Sub


Private Sub Form_Unload(Cancel As Integer)
Call menuhabilitado(True)
End Sub

Private Sub Txt_Contenido_GotFocus()
If Me.lst_usu_destino.SelCount = 0 Then
    MsgBox ("Debe seleccionar destinatario")
    Me.lst_usu_destino.SetFocus
End If

End Sub
